468,249 Members | 1,461 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,249 developers. It's quick & easy.

DataBind and PageLoad

2 scenario inside a WebUserControl. I want to know why Microsoft and so many
book doesn't suggest us to work like that. This control going to be in my
page and I will call the DataBind of my user control.

PAGE
page_load(....)
{
if(!IsPostBack)
{
this.WebUserControl1.DataBind();
or also depend what you realy want
DataBind();
}
}

CONTROL

...first scenario
page_load(....)
{
if(!IsPostBack)
{
LoadData(Table);
this.dtgMain.DataSource = Table;
this.dtgMain.DataBind();
}
}
....second scenario
override DataBind(....)
{
LoadData(Table);
this.dtgMain.DataSource = Table;
this.dtgMain.DataBind();
.... and sometime
base.DataBind();
}

Should be a good idea to fallow the same pattern for the HTML then for the
codebehind!! I mean in html only when you databind that the value are set
for the <%#%>.
It is using DataBind method in bad way?


Jul 21 '05 #1
0 1235

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Marty McDonald | last post: by
reply views Thread by Stephan Bour | last post: by
2 posts views Thread by Stephan Bour | last post: by
3 posts views Thread by Antoine | last post: by
4 posts views Thread by Wayne Wengert | last post: by
reply views Thread by autofill | last post: by
1 post views Thread by Alex Maghen | last post: by
2 posts views Thread by =?Utf-8?B?UGhpbCBKb2huc29u?= | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.