Hi Experts,
I have a simple WebForm it has a TextBox
my TextBox has OnChange Event and its AutoPostBack property is true,
now what I want to accomplish is to make a Button to raise this event for me at client side(with javascript)
when I view the source of my ASP.NET page it is something like bellow,
Code:
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["Form1"];
}
else {
theform = document.Form1;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
<input type="submit" name="Button1" value="Button" id="Button1" />
<button id="mahdi" type="button" language="javascript" onclick="document.Form1.TextBox1.onchange();">
mehdi</button>
<input name="TextBox1" type="text" onchange="__doPostBack('TextBox1','')" language="javascript" id="TextBox1" />
<span id="Label1">Label</span>
</form>
what I did ,I made a simple button(runat=server) and for its onclick I execute the TextBox onchange attribute
this is the tag I used for my button to raise the server side event,
<button id="mahdie" type="button" onclick="document.Form1.TextBox1.onchange();">
now when I test my page the OnChange event at server side doesn't fire
any opinion?
Thanks in advance.
_____________
Mehdi.
software student.