How to add a link in linkbutton, am using Visual Studio 2008 C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Time
    New Member
    • Jan 2010
    • 77

    How to add a link in linkbutton, am using Visual Studio 2008 C#

    Hello everyone,
    I am making a website using visual studio 2008; in C#. I want my page to navigate after clicking a button, I used linkbutton, but I didn't like it, as it looks different than the button. And I also don't know how to use anchor tag in c#. One more thing, I want to have a drop down list, after clicking a button, but couldn't find any option like that. I don't want to use a drop down list directly... as am having all the buttons in a row and I want all of them to look like a button.
  • Time
    New Member
    • Jan 2010
    • 77

    #2
    I want a button to have a drop down list...how to do it?

    Comment

    • Time
      New Member
      • Jan 2010
      • 77

      #3
      Code:
      DropDownList1.SelectedIndex == 0)
              {
                  Response.Redirect("page")
              }
      the above code helped!

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        I am making a website using visual studio 2008; in C#. I want my page to navigate after clicking a button...
        Handle the click event for the button and call Response.Redire ct method to redirect to the other page.

        For example, if you had a button named "NavigateToNext Page" defined in your asp code like this:
        Code:
        <asp:Button id="NavigateToNextPage"
                   Text="Go To Next Page"
                   OnClick="NavigateToNextPage_Click" 
                   runat="server"/>
        Your C# code could look something like:
        Code:
        void NavigateToNextPage_Click(Object sender, EventArgs e)
        {
            Response.Redirect("http://theNextPage.aspx");
        }

        And I also don't know how to use anchor tag in c#...
        You use the Hyperlink Class to create anchors in ASP.NET


        One more thing, I want to have a drop down list, after clicking a button, but couldn't find any option like that
        Add a DropDownList to your page and set its Visible property to false so that the control is never rendered into the HTML by default. Then, in the method that handles the click event for the button that displays the DropDownList, set the Visible property to true.


        -Frinny
        Last edited by Frinavale; Feb 11 '14, 02:33 PM.

        Comment

        Working...