Databind and event

V

Victor

Hi all
Do I have to call my databind event for my control in the page_load event? I
try to call my databind event for my contorl in the loadcomplete event. but
seems it doesn't work at all

Pls help.
Cheers
 
M

Masudur

Hi all
Do I have to call my databind event for my control in the page_load event? I
try to call my databind event for my contorl in the loadcomplete event. but
seems it doesn't work at all

Pls help.
Cheers

Hi,

After load the new data .... do call the databind function...
i.e. grid.databind();
it could be in page load and in some events also

Thanks
Masudur
 
W

Walter Wang [MSFT]

Hi Victor,

How is your complete page code looks like? According to ASP.NET Page Life
Cycle (http://msdn2.microsoft.com/en-us/library/ms178472.aspx), there's
only Control events between the Page's Load and LoadComplete event. Also,
I've tested using a simple webpage and following code works:

protected void Page_Load(object sender, EventArgs e)
{
this.LoadComplete += new EventHandler(_Default_LoadComplete);
}

void _Default_LoadComplete(object sender, EventArgs e)
{
BindGrid();
}

private void BindGrid()
{
DataTable dt = new DataTable();
dt.Columns.Add("Name");
dt.Rows.Add("Test");
GridView1.DataSource = dt;
GridView1.DataBind();
}


Please post your code. Thanks.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Walter Wang [MSFT]

Hi Victor,

Have you seen my last reply? Please reply here if you want to continue work
on this. Thanks.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
V

Victor

Hi Walter.
The truth is I didn't reslove my problem. And I have no idea what is going
on there. My assumption is my onitembound method is my customized control is
not working properly, or not been updated after postback..
Anyway. i have changed my control and used another way. let's leave it for
now..
Thanks a lot for your help.

Cheers
Victor
 

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top