|
FAQsQ. Why doesn't my default GridLayout project display correctly in Netscape 4.7. A. For maximum compatibility, try building your project using FlowLayout and nested tables. Q. Why doesn't my DataGrid show up when I run the project? I can see it in the design view. A. You need to fill the
DataSet and call DataBind in Page_Load. Q. Why are all of my changes lost on post back? A. Don't call DataBind except on the initial page load or in your event handlers, allowing the grid to be repopulated from the ViewState. // This code executes every time sqlDataAdapter1.Fill(dataSet11); // This code executes the first time only
if (!IsPostBack)
{
DataGrid1.DataBind();
}Q. Why can't I debug? A. Under IIS Properties --> Directory Security --> Anonymous Access Edit --> Enable Integrated Windows Authentication. Q. Why do I need a logon password to access a web page directly from IE? A. Enable Guest Account ant then under Control Panel --> User Accounts --> Change an Account --> Guest --> Remove the password. Q. How do I turn off auto formatting in the HTML view? A. Go to Tools --> Options... --> Text Editor --> HTML/XML --> HTML Specific and disable "Statement Completion". Q. Why are the instance variables re-initialized on post back? A. Since the web is by nature stateless, changes to a instance variable are lost on post back. To implement "state", you must manually write the value of the variable to the ViewState object and then read the saved value of the variable from the ViewState on post back. // This code executes the first time only
if (!IsPostBack)
{
view.Sort = "au_id"+ " ASC";
ViewState["LastSortOrder"]="ASC";
ViewState["LastSortColumn"]= "au_id";
ViewState["LastFilter"]= "";
DataGrid1.DataBind();
}
else // This code executes only on post back
{
string lastSortColumn= (string)ViewState["LastSortColumn"];
string lastSortOrder= (string)ViewState["LastSortOrder"];
string lastFilter= (string)ViewState["LastFilter"];
view.Sort= lastSortColumn+ " "+ lastSortOrder;
view.RowFilter= lastFilter;
}
|
Send mail to [email protected]
with questions or comments about this web site. Copyright © 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009 ©
|