Thursday 29 November 2012

Insert date in sql server from c#

 System.Globalization.CultureInfo dateformat = new System.Globalization.CultureInfo("en-GB", true);


                DateTime fromdate = Convert.ToDateTime(txtFromdate.Text, dateformat);

How to pass QueryString Between Pages in C#

For passing variables content between pages ASP.NET gives us several choices. One choice is using QueryString property of Request Object.

Put this code to your submit button event handler.

Response.Redirect("SparePartItemReport.aspx?OrderNo=" + txtOrderNo.Text + "&Status=Inventoried");

 Our first code part builds a query string for your application and send contents of your textboxes to second page. Now how to retrieve this values from second page. Put this code to second page page_load.


 if (Request.QueryString["OrderNo"] != null && Request.QueryString["OrderNo"].ToString() != "" && Request.QueryString["Status"] != null && Request.QueryString["Status"].ToString() != "")
            {
                string OrderNo = Request.QueryString["OrderNo"].ToString();
                string Status = Request.QueryString["Status"].ToString();

}