OK, so I’m using __doPostBack() to reload data in an update panel based on some javascript after the user enters data.
Everything on the page is working correctly, except that when the javascript tells it to fire and reload the updatePanel, the whole page reloads and the UpdatePanel1_Load() isn’t firing.
Any idea why? Here’s my javascript to fire it:
var submitTimerID
function jsfunct_textChange(obj_validateItem, validationStyle, validationFailDefaultValue, objPanelToUpdate){
var isValid = true;
if (validationStyle == 'numeric'){
if (
(obj_validateItem.value != parseInt(obj_validateItem.value) ) &&
(obj_validateItem.value.length > 0)
){
alert('Value must be a number!');
isValid = false;
obj_validateItem.value = validationFailDefaultValue;
}
} // numeric validation
if (isValid){
if (typeof submitTimerID != 'undefined') {clearTimeout ( submitTimerID );}
submitTimerID = setTimeout ( "jsfunct_SendUpdate('" + objPanelToUpdate + "');", 3000 );
}//isValid
}// jsfunct_textChange
function jsfunct_SendUpdate(objPanelToUpdate){
var obj_Panel = document.getElementById(objPanelToUpdate);
__doPostBack(obj_Panel, '');
}
Here’s the update panel:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
...
</ContentTemplate>
</asp:UpdatePanel>
And in my codebehind:
protected void UpdatePanel1_Load(object sender, EventArgs e)
{}
protected void Page_Load(object sender, EventArgs e)
{
LoadGrid();
}
The LoadGrid(); method will fire when in Page_Load(), but not when it’s in UpdatePanel1_Load(), which makes sence, as the whole page is loading, but the panel isn’t refreshing.
Any help is much appreciated!
-Josh