Solved

asp.net and javascript link submit

Posted on 2014-09-24
2
224 Views
Last Modified: 2014-09-25
<asp:DropDownList runat="server" ID="brand">
                                                <asp:ListItem selected="True" Text="HP" Value="HP"></asp:ListItem>
                                                <asp:ListItem Text="Canon" Value="Canon"></asp:ListItem>
                                            </asp:DropDownList>



<asp:DataList Width="800px" runat="server" ID="dataListBrand" RepeatColumns="8" RepeatDirection="Vertical" >
                                            <ItemTemplate>
                                             <li>
                                             <a href="Brand.aspx?Name=<%# Eval("name") %>">
                                             <asp:Label Width="140px" runat="server" ID="repeatListItemCategory" Text='<%# Bind("name") %>'></asp:Label>                                            
                                             </a>
                                             </li>
                                            </ItemTemplate>
                                            </asp:DataList>        


 

If <a href="Brand.aspx?Name=<%# Eval("name") %>"> is clicked, it is a link then I
want to capture both values from <a href="Brand.aspx?Name=<%# Eval("name") %>"> and brand.

How can I do that?
0
Comment
Question by:ITsolutionWizard
2 Comments
 
LVL 2

Accepted Solution

by:
Vishal Patil earned 500 total points
ID: 40343637
Hello  ITsolutionWizard,

Please check with following code:

Javascript:
    <script type="text/javascript">
        function SayHello(txt, contact) {
            document.getElementById("<%= brand.ClientID %>");
            alert(document.getElementById("<%= brand.ClientID %>").value);
            alert(txt);
            window.open(contact, "Tesst");
            return false;
        }
    </script>

Open in new window


Source :

<asp:DropDownList runat="server" ID="brand">
        <asp:ListItem Selected="True" Text="HP" Value="HP"></asp:ListItem>
        <asp:ListItem Text="Canon" Value="Canon"></asp:ListItem>
    </asp:DropDownList>
    <asp:DataList Width="800px" runat="server" ID="dataListBrand" RepeatColumns="8" RepeatDirection="Vertical">
        <ItemTemplate>
            <li><a href="" onclick='javascript:return SayHello("<%# Eval("name") %>","Brand.aspx?Name=<%# Eval("name") %>");'>
                <asp:Label Width="140px" runat="server" ID="repeatListItemCategory" Text='<%# Bind("name") %>'></asp:Label>
            </a></li>
        </ItemTemplate>
    </asp:DataList>

Open in new window

0
 

Author Closing Comment

by:ITsolutionWizard
ID: 40344658
quick and accurate.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question