Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Anchor Tag In Code Behind

Anchor Tag In Code Behind

Scheduled Pinned Locked Moved ASP.NET
helpsysadminquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sanket Patil
    wrote on last edited by
    #1

    Hi All, I am developing one website. In That I want to call a popup window on dropdown_selectedIndexChaged. If I put That DropDown in an Anchor tag The Window Opens As Soon As I Click On DropDown Which I Dont Want. I Want that Popup Should Open After Selecting The Value Of That DropDown. So Please Help Me To Solve My Problem. And is there any way to write Anchor Tag in code behind and Call It On dropdown_selectedIndexChaged To Open A Popup. My Anchor tag Is Like This :

               <a id="AA1" runat="server" class="thickbox" title="" href="InventoryQty.aspx?action=add&TB\_iframe=true&height=420&width=700">
                        <asp:DropDownList ID="InsertDDLItem1" runat="server"
                                            AppendDataBoundItems="true"
                                            DataTextField="ItemName" 
                                            DataValueField="ItemID"
                                            AutoPostBack="true"
                                            OnSelectedIndexChanged="InsertDDLItem1\_SelectedIndexChanged" Width="280px">
                            <asp:ListItem Selected="True" Value="0">Select ITem Type</asp:ListItem>
                        </asp:DropDownList>
                        </a>
    

    Please Help Me To Solve My Problem. Thanks & Regards Sanket Patil :) :)

    .

    N A S 3 Replies Last reply
    0
    • S Sanket Patil

      Hi All, I am developing one website. In That I want to call a popup window on dropdown_selectedIndexChaged. If I put That DropDown in an Anchor tag The Window Opens As Soon As I Click On DropDown Which I Dont Want. I Want that Popup Should Open After Selecting The Value Of That DropDown. So Please Help Me To Solve My Problem. And is there any way to write Anchor Tag in code behind and Call It On dropdown_selectedIndexChaged To Open A Popup. My Anchor tag Is Like This :

                 <a id="AA1" runat="server" class="thickbox" title="" href="InventoryQty.aspx?action=add&TB\_iframe=true&height=420&width=700">
                          <asp:DropDownList ID="InsertDDLItem1" runat="server"
                                              AppendDataBoundItems="true"
                                              DataTextField="ItemName" 
                                              DataValueField="ItemID"
                                              AutoPostBack="true"
                                              OnSelectedIndexChanged="InsertDDLItem1\_SelectedIndexChanged" Width="280px">
                              <asp:ListItem Selected="True" Value="0">Select ITem Type</asp:ListItem>
                          </asp:DropDownList>
                          </a>
      

      Please Help Me To Solve My Problem. Thanks & Regards Sanket Patil :) :)

      .

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      This would best be implemented using JavaScript and handling the onchange event there to open the new window.


      I know the language. I've read a book. - _Madmatt

      1 Reply Last reply
      0
      • S Sanket Patil

        Hi All, I am developing one website. In That I want to call a popup window on dropdown_selectedIndexChaged. If I put That DropDown in an Anchor tag The Window Opens As Soon As I Click On DropDown Which I Dont Want. I Want that Popup Should Open After Selecting The Value Of That DropDown. So Please Help Me To Solve My Problem. And is there any way to write Anchor Tag in code behind and Call It On dropdown_selectedIndexChaged To Open A Popup. My Anchor tag Is Like This :

                   <a id="AA1" runat="server" class="thickbox" title="" href="InventoryQty.aspx?action=add&TB\_iframe=true&height=420&width=700">
                            <asp:DropDownList ID="InsertDDLItem1" runat="server"
                                                AppendDataBoundItems="true"
                                                DataTextField="ItemName" 
                                                DataValueField="ItemID"
                                                AutoPostBack="true"
                                                OnSelectedIndexChanged="InsertDDLItem1\_SelectedIndexChanged" Width="280px">
                                <asp:ListItem Selected="True" Value="0">Select ITem Type</asp:ListItem>
                            </asp:DropDownList>
                            </a>
        

        Please Help Me To Solve My Problem. Thanks & Regards Sanket Patil :) :)

        .

        A Offline
        A Offline
        AspDotNetDev
        wrote on last edited by
        #3

        First of all, get rid of the anchor tag. You'll need to use the onchange event to initiate some JavaScript to open a window. You'll have to modify it a bit to work with your code, but this is some code I had laying around that you can use:

        <script type="text/javascript">
        function HandleDDClick(element) {
        if(element.selectedIndex > 0) {
        var url = element.options[element.selectedIndex].value;
        window.open(url);
        }
        }
        </script>

        [Managing Your JavaScript Library in ASP.NET]

        1 Reply Last reply
        0
        • S Sanket Patil

          Hi All, I am developing one website. In That I want to call a popup window on dropdown_selectedIndexChaged. If I put That DropDown in an Anchor tag The Window Opens As Soon As I Click On DropDown Which I Dont Want. I Want that Popup Should Open After Selecting The Value Of That DropDown. So Please Help Me To Solve My Problem. And is there any way to write Anchor Tag in code behind and Call It On dropdown_selectedIndexChaged To Open A Popup. My Anchor tag Is Like This :

                     <a id="AA1" runat="server" class="thickbox" title="" href="InventoryQty.aspx?action=add&TB\_iframe=true&height=420&width=700">
                              <asp:DropDownList ID="InsertDDLItem1" runat="server"
                                                  AppendDataBoundItems="true"
                                                  DataTextField="ItemName" 
                                                  DataValueField="ItemID"
                                                  AutoPostBack="true"
                                                  OnSelectedIndexChanged="InsertDDLItem1\_SelectedIndexChanged" Width="280px">
                                  <asp:ListItem Selected="True" Value="0">Select ITem Type</asp:ListItem>
                              </asp:DropDownList>
                              </a>
          

          Please Help Me To Solve My Problem. Thanks & Regards Sanket Patil :) :)

          .

          S Offline
          S Offline
          scy278753517
          wrote on last edited by
          #4

          Oh man,if you have the dropdownlist's autopostback on ,then you will get the popup very hard. you can register your popup code in the indexchabged event.or just like above,you can write the popup code in the client,and register the popupcode into the dropdownlist ,and use the onchange event to trigger.

          I can do!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups