I'm currently setting a flag and calling submit(), which causes a postback.
Now I have the mysterious problem that when my Page_Load fires, and calls
the refresh code, nothing happens, but when I click the Refresh button
straight after that, the page does refresh.
My code follows (the '$' function is a dirty shorthand for
GetElementsByTagName). In both cases InitGrid is called, but the page only
refreshes when btnRefresh is clicked.
function refreshMainForm() {
var myForm = $('m').contentDocument.forms[0];
debugger;
if (myForm.isRefresh)
{
myForm.isRefresh.value = "y";
myForm.submit();
}
}
protected void Page_Load(object sender, EventArgs e)
{
if ((!IsPostBack) || (isRefresh.Value == "y"))
{
isRefresh.Value = "";
lblFormName.Text = MyController.FormName;
InitGrid();
}
}
protected void btnRefresh_Click(object sender, ImageClickEventArgs e)
{
InitGrid();
}
Post by Shawn Wildermuth-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
Sent: 24 January 2008 09:08 PM
Subject: Re: [DOTNET-WEB] Simulate button click to trigger postback
Can't you just call the PostBack Javascript method that is created ASP.NET
pages? View the source of the page and see what happens when the button is
clicked.
Thanks,
Shawn Wildermuth
http://adoguy.com
http://wildermuthconsulting.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker
The Silverlight Tour is coming to a city near you!
-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
Sent: Thursday, January 24, 2008 1:45 PM
Subject: [DOTNET-WEB] Simulate button click to trigger postback
I have tried many ways of forcing a page refresh from within
Javascript, but
my learned colleagues of implemented some sort of URL uniqueness scheme to
prevent caching and I think this is messing me around. I have a Refresh
button on the page for a manual refresh, so how do I go about
triggering the
server side Click event for that button?
===================================
This list is hosted by DevelopMentor. http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor. http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor� http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com