The situation is I want to add new button in my html aspx file (existing file). But I keep getting Server Error in '/' Application (Runtime Error) in the page after adding new button. Below is the error:
If I remove back the html markup, the page come back OK.
<asp:button id="btnSelect" runat="server" onclick="select_Click" text="Select"/>
Then, I add inside html markup page , for example below, the Select Button will show a popup message for Selected Date, it's ok like I want. But I cannot add query to save the selected date into SQl database here because the select_Click button event is inside html markup aspx page. It's look like this button is inside Content Control and I'm not allowed to add button inside the existing file of html markup aspx. Then, when I add select_Click event function in my Example.aspx.cs page the button will do nothing. Supposedly the select_Click event function is inside Example.aspx.cs file.
Anyone got any ideas why this happen??? Note: The existing file is created by previous developer.
<script runat="server">
protected void submit_Click(object sender, EventArgs e)
{
string targetdate = Request.Form[TargetDate.UniqueID];
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Selected Date: " + targetdate + "');", true);
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="container">
<table id="table2" style="text-align: center; width: 100%">
<tr>
<td class="auto-style1" style="text-align: center; height: 51px;">
<asp:Label ID="lblTitle" runat="server" Text="Case Detail" Font-Bold="True" Font-Size="XX-Large" Font-Names="Verdana" Font-Underline="True"></asp:Label></td>
</tr>
</table>
</div>
</asp:Content>
Thankyou for your time by reading this.
