locked
InnerHtml not working please help :solved RRS feed

  • Question

  • User-1502166026 posted

    Hey

    Im trying to edit a div in my page with asp.net c#.

    Im using the InnerHtml property but its not working.

    I have added the runat=server tag but its still not working 

    This is my code:

    <form onsubmit="return logIn()" id="login" runat="server" action="Login_page.aspx">

    <input type="text" name="mail" id="mail" />
    <div id="mailcheck" runat="server"></div>
    <br />

    <input type="text" name="password" id="password" />
    <div id="pswcheck" runat="server"></div>
    <br />
    <div id="err" runat="server"></div>
    <br />
    <br />
    <input type="submit" name=" submit" id="submit" value="היכנס" runat="server" />

    server side:

    err.InnerHtml = "error";

    solved:

    It worked for me from the code behind

    Friday, May 24, 2019 11:54 PM

All replies

  • User61956409 posted

    Hi OriNagor,

    Glad to hear that you solved the problem by yourself, and thanks for sharing the solution.

    have added the runat=server tag

    If you added id and runat=server attributes to tag(s), you will be able to access it from code behind. 

    Besides, to assign text to div tag, we can use

    err.InnerHtml = "your_text_here";

    or

    err.InnerText = "your_text_here";

    With Regards,

    Fei Han

    Monday, May 27, 2019 1:56 AM