Google Brother Up

Showing posts with label code behind. Show all posts
Showing posts with label code behind. Show all posts

2009/02/24

Alert Message using Response.Write in Web through C# Code

1) Hardcoded Alert

Response.Write("{script}alert("Hello");{/script}");

2) Variable Alert

string txtName = "Hello " + txtText.Text;
Response.Write("{script}alert('" + txtName + "');{/script}");

205 unique visitors

2009/02/23

Required Field Validator does not fire in Firefox - Solution

Always write code under Page.IsValid scope if Required Field Validator does not fire in Firefox but fires in IE.

try
 {
       if (Page.IsValid)
     {
            // code
      }
 }
 catch (Exception ex)
{
       string msg = ex.Message;
}

203 unique visitors

2008/10/31

Paging Code Behind

protected void gvColumnList_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {        
        gvColumnList.PageIndex = e.NewPageIndex;
        gvColumnList.DataSource = ViewState["vsGridView"];
        gvColumnList.DataBind();                        
    }


106 unique visitors

2008/05/08

THIS DATASOURCE DOES NOT SUPPORT SERVER-SIDE DATA PAGING

To solve this problem (THIS DATASOURCE DOES NOT SUPPORT SERVER-SIDE DATA PAGING ), you must set GridView DataSource Property as DataSet not DataReader .

2008/01/07

GridView PageIndex Code Behind

protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gridView.PageIndex = e.NewPageIndex;
gridView.DataBind();
}

Drop Down List

1. http://www.janetsystems.co.uk/Articles/NetArticles/tabid/74/itemid/161/modid/449/Default.aspx