You must Sign In to post a response.
  • Category: ASP.NET

    How to access div tag from code behind C#?

    I am developing a website using
    I want to create a button that can save user data then move to a div tag at the same page.

    I already did the saving part, but how do I make the same button to navigate to a different div tag within the same page?
    some people use the response.redirect method to navigate to a different page. I want to navigate to a <div> tag within the same page. For example:
    <a href="#experience">Experience</a>
    after I press that it will take me to:
    <div class="panel" id="experience">

    I want to do the same but with button that can do that and save to the database. As I said, I already did the saving part.

    I tried this:
    <asp:Button ID="Button1" runat="server" Text="Save & Continue" OnClientClick="#experience" OnClick="Button1_Click" />
    But it didnt work.

    any ideas?
  • #761599
    use the runat="server" in the div tag. So that you can access that in the code behind
    By Nathan
    Direction is important than speed

  • #761613
    I did but i don't know what to write in code behind

  • #761614
    Hi Moe

    <div class="panel" id="experience" runat="server">

    Control myControl1 = FindControl("experience");
    //do code


    Sridhar Thota.
    If you learn from defeat..
    You havent really lost..

    Sridhar Thota.
    Editor: DNS Forum.

  • #761622
    Hello Moe,

    Refer the below code :

    <div class="something" ID="mydiv" runat="server">

    protected void Page_Load(object sender, EventArgs e)
    mydiv.InnerHtml += "test"; // Check mydiv is accessible??

    Hope this will help you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

Sign In to post your comments