Guess what, I found both answers with ggogle...
Ramesh Reddy11111 wrote:
how
to restrict postback on entire page in asp.ne
Remove the
runat="server"
attribute from the control
You can also add an
onclick
attribute to the control and return true i.e.
YourButton.Attributes.Add("onclick", "<script>return true</script>");
Ramesh Reddy11111 wrote:
how to get Datamember and ValueMembet value of selected item in combobox through JavaScript
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<img src="images\cal.gif"
onclick="openCalendar(<% = txtDate.ClientID %>, 150, -150);return false;" />
A little more proper way would be:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="images/cal.gif" />
protected void Page_Load(object sender, EventArgs e)
{
ImageButton1.OnClientClick = "openCalendar(" + TextBox1.ClientID + ", " + X.ToString() + ", " + Y.ToString() + ");return false;";
}