C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

ASP.NET Page_Load() event handling for QueryStrings Values


Posted Date: 15 Jun 2004    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: ShajanMember Level: Silver    
Rating: 1 out of 5Points: 5




private void Page_Load(object sender, System.EventArgs e)
{
//code that should be executed at each time when the page is processed in the server...

if(Request.QueryString.GetValues("mode")!=null)
//find whether the mode has been set
{
if(Request.QueryString.GetValues("mode")[0]=="save")
//action is save
{
if (SaveDetails()==1)
//calling a local function when mode is 'save'
{
return;
}
Response.Write("<script>");
Response.Write("window.opener.document.location='xxx.aspx';");
Response.Write("window.close();");
Response.Write("</script>");
}
}

if(Page.IsPostBack)
return;
//code that should be executed when the page is loaded for the first time only...
if(Request.QueryString.GetValues("xxxID")!=null) //Edit Mode
{
lblPageTitle.Text="Edit XXX";
PopulateForm(Request.QueryString.GetValues("xxxID")[0]);
}
else

//Add Mode
{
lblPageTitle.Text="Create XXX";
}

}


private void PopulateForm(string xxxID)
{
DataSet objDS;
string dllError="";
int intxxxID=System.Convert.ToInt32(xxxID,10);
// Now U fill the DataSet here. then Use the following
txtName.Text = objDS.Tables[0].Rows[0].ItemArray[1].ToString();
txtDescription.Text = objDS.Tables[0].Rows[0].ItemArray[2].ToString();
hdnID.Text=objDS.Tables[0].Rows[0].ItemArray[0].ToString();
}




Responses

Author: critic    15 Jun 2004Member Level: Bronze   Points : 0
The source code you submitted do not have proper indentation. This will give a wrong idea to our readers. If this is not corrected within 1 day, your articles will be deleted.

Also, source code without proper description will not be acceptible.


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Displaying the Records in DataGrid from Ascending to Descending and Viceversa
Previous Resource: ASP.NET Validation Behavior Cleared Out
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use