why would you want to fire a button click even when the page loads?
just put the button click code in the page load event from the start. Or
create a seperate method that the page_load and the button click event can
both call.
why would you want to fire a button click even when the page loads?
just put the button click code in the page load event from the start. Or
create a seperate method that the page_load and the button click event can
both call.
i am displaying a table in page load whose data is fetched from
database .
it also check what data is to be displayed from data base by a session
variable.
and i have few button which change the session variable value.
when i click on some button page load is called before button click
event,
so data which is displayed is according to previous session not the
session changed by button click.
therefore i want that some how i call button click event before page
load event....
or is there any other alternative...
then just pass that session to a method that loads the data when the page
first loads, then when the user makes a change call that same method with
the data value
something like this:
page_onLoad()
{
//if page is loaded for the first time, load your data
if(!Postback())
{
loadData(data value);
}
}
//load data
void loadData(string datavalue)
{
//here is were you would put your code to load your data and pass the
datavalue to your proc
}
//when the user clicks the button, call the loadData method and pass the
value to the method
button_onClick()
{
loadData(datavalue);
}
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.