Whenever we are developing any websites in asp.net then sometimes we need to use html control and its really very challenging that how to get the values of that control from source code or back end .And once we got the value in that html control then we can perform any operations like Insert, Delete, Update into database.
The most important things is that sometime we need to retrieve the values of those html controls as it is not declared as runat="server" on the page. And if we not include runat=”server” then we can’t fetch “Id” of that controls from source code.
So here I had demonstrated a simple demo that how to get html control textbox value from source code without include runat=server.Most of time we fetch problems on getting the selected date from textbox using datepicker Jquery.
Here is the simple way to get values of the html input controls which doesn't have runat="server" attribute defined.
1. First we have to take HTML control on which we can select date.
- <table class="myTable" align="center">
- <tr>
- <td>
- Select Date
- </td>
- <td>
- <input type="text" id="datepicker" name="_datepicker" />
- <asp:Button ID="btnSave" runat="server" Text="Show Date" Style="width: 86px; height: 36px;" OnClick="btnSave_Click" />
- </td>
- </tr>
- <tr>
- <td></td>
- <td>
- <asp:Label ID="lblDate" runat="server" Text=""></asp:Label>
- </td>
- </tr>
- </table>

Prakash NairPosted Apr 22, 2021, 3:53 AM
Very helpful thank you