//assign datatable to viewstate.
ViewState["dtQues"] = dtQue;
DataTable dt1 = (DataTable)ViewState["dtQues"];
Wednesday, March 31, 2010
Tuesday, March 30, 2010
HOw to add pager style...
1) Allow Paging =true
2) allow sorting=true.
NextPageText="Next " PreviousPageText="Previous" />
protected void gvrListOfStudent_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvrListOfStudent.PageIndex = e.NewPageIndex;
gvrListOfStudent.DataBind();
}
2) allow sorting=true.
protected void gvrListOfStudent_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvrListOfStudent.PageIndex = e.NewPageIndex;
gvrListOfStudent.DataBind();
}
Wednesday, March 10, 2010
How to pass two values two query string
window.location="ViewMemberDetails.aspx?view_id="+memberid+"&mem_no="+memberno;
Saturday, March 6, 2010
How to automatic REFRESH webpage after few seconds.
Just add Meta tag b4 / after HTML tag on web page.
//** meta http-equiv="Refresh" content="5" ** //
//** meta http-equiv="Refresh" content="5" ** //
How to fill DROPDOWN LIST on row data bound
protected void Page_Load(object sender, EventArgs e)
{
conn.Open();
da = new SqlDataAdapter("Select User_id,Name,EmailId,City_id,Qualification from tbl_user", conn);
da.Fill(ds,"tbl_User");
GridView1.DataSource = ds;
GridView1.DataBind();
GridView1.Columns[3].Visible = false;
conn.Close();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType != DataControlRowType.Header)
{
DropDownList drdp1 = new DropDownList();
drdp1 = (DropDownList)e.Row.Cells[4].FindControl("drdp");
//int user_id =Convert.ToInt32(e.Row.Cells[1].Text);
DataSet ds1 = new DataSet();
SqlDataAdapter da1 = new SqlDataAdapter("Select City_name,City_id from tbl_city", conn);
da1.Fill(ds1, "tbl_drdp");
drdp1.DataSource = ds1;
drdp1.DataTextField = ds1.Tables[0].Columns["City_name"].ColumnName.ToString();
drdp1.DataValueField = ds1.Tables[0].Columns["City_id"].ColumnName.ToString();
drdp1.SelectedIndex = Convert.ToInt32(e.Row.Cells[3].Text);
drdp1.DataBind();
}
}
catch(Exception ex)
{
ex = ex;
}
}
{
conn.Open();
da = new SqlDataAdapter("Select User_id,Name,EmailId,City_id,Qualification from tbl_user", conn);
da.Fill(ds,"tbl_User");
GridView1.DataSource = ds;
GridView1.DataBind();
GridView1.Columns[3].Visible = false;
conn.Close();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType != DataControlRowType.Header)
{
DropDownList drdp1 = new DropDownList();
drdp1 = (DropDownList)e.Row.Cells[4].FindControl("drdp");
//int user_id =Convert.ToInt32(e.Row.Cells[1].Text);
DataSet ds1 = new DataSet();
SqlDataAdapter da1 = new SqlDataAdapter("Select City_name,City_id from tbl_city", conn);
da1.Fill(ds1, "tbl_drdp");
drdp1.DataSource = ds1;
drdp1.DataTextField = ds1.Tables[0].Columns["City_name"].ColumnName.ToString();
drdp1.DataValueField = ds1.Tables[0].Columns["City_id"].ColumnName.ToString();
drdp1.SelectedIndex = Convert.ToInt32(e.Row.Cells[3].Text);
drdp1.DataBind();
}
}
catch(Exception ex)
{
ex = ex;
}
}
Subscribe to:
Posts (Atom)