473,386 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1390

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Marty McDonald | last post by:
I have <asp:Table... </asp:Table> on my webform. In codebehind, I populate a DataTable whose data should appear in the asp:Table. I created my own code to populate the asp:Table with the...
0
by: Stephan Bour | last post by:
Hi, I have a query page were users can check previous orders according to a number of parameters. The query results are presented in a datalist and the datasource is a sql query. Since I capture...
2
by: Stephan Bour | last post by:
I repost this since I know how much some list people hate html posts ;-) Hi, I have a query page were users can check previous orders according to a number of parameters. The query results are...
3
by: Antoine | last post by:
Is there anything that can make my project run its pageload twice? I added trace lines throughout code, and then checked recently. Unless its a temporary issue (resolved by reboot etc) I...
4
by: Wayne Wengert | last post by:
I have a form that has a cbo set to TabIndex 0 (it is the only item set to tabindex 0). On page Load if I step through the code that cbo LostFocus event fires after other initializations are...
0
by: autofill | last post by:
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...
1
by: Alex Maghen | last post by:
I have a DataGrid on my ASPX and I'm confused about the interaction with the page based on whether the page is just loading or is being reloaded with a call to the SortCommand of the DataGrid: ...
2
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hello, I have a page that contains a user control that is nested within other user controls... the nesting is quite deep, not sure exactly how ddep but there is a control inside a control inside...
1
by: Chris Date | last post by:
Hi I´ve got a problem with my scrollable table. It´s a weekscheduler table with 7 columns ( weekdays ) and dynamicaly rows ( time ). So the rows starts at 0:00am and ends at 12:00pm ( 24:00h )....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.