Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

asp.net and javascript link submit

Posted on 2014-09-24
2
225 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

839 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