Hi..All,
Can somebody please tell me what is wrong with this ASP.NET page??

The browser is returning me the error
--> SubmitBtn_click is undefined <--

here is the code
......
...

<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@Import Namespace="System"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="C#" runat="server">
void SubmitBtn_Click(Object Source,EventArgs e)
{   
    spanMessage.InnerHtml = GetFormattedDate(sugg.Value);
}
</script>   
<script language="C#" runat="server">
public static String GetFormattedDate(string cChoice)
{
    string sReturn;
    switch(cChoice.ToString())
    {
        case "0": sReturn=DateTime.Now.ToShortDateString();
                  break;
        case "1": sReturn=DateTime.Now.ToShortTimeString();
                  break;
        case "2": sReturn=DateTime.Now.DayOfWeek.ToString();
                  break;
        case "3": sReturn=DateTime.Now.ToString();
                  break;
        default:  sReturn ="None";
                  break;
    }
    return sReturn;
}
</script>
</head>
<body>
</body>
</html>
<form id="formConvert" runat="server">
  <select ID="sugg" runat="server">
  <option value="0">Short Date</option>
    <option value="1">Short Time</option>
      <option value="2">Day of the Week</option>
        <option value="3">Date and Time</option>
  </select>
  <input type="Submit" value="Submit" onClick="SubmitBtn_Click" runat="server"/>
 <SPAN ID="spanMessage" runat="server"/>
</form>

Thankyou.

Not sure if it will work but try changing onClick in the input button's tag to onServerClick. If that doesn't work, give the button an ID and then add a handles ButtonID.ServerClick to the function declaration.

thanx for your response, I will try that and get back to you, thanx again..

thank you guys, I will try that and hope it works.........thankyou all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.