DateTime date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
Thursday, June 16, 2011
Monday, May 30, 2011
Sunday, May 29, 2011
How to create dynamic GRID VIEW in asp.net
public void loaddynamicgrid()
{
DataTable dt = new DataTable();
DataColumn dc;
DataRow dRow;
dc = new DataColumn("Date", typeof(DateTime));
dt.Columns.Add(dc);
dc = new DataColumn("Name", typeof(Int64));
dt.Columns.Add(dc);
SqlDataAdapter da = new SqlDataAdapter("select * from Tbl_Emp", Sqlconnectionstring);
DataSet ds = new DataSet();
da.Fill(ds);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
dRow = dt.NewRow();
dt.Rows.Add(dRow);
dt.Rows[i][0] = ds.Tables[0].Rows[i]["date"].ToString();
dt.Rows[i][1] = ds.Tables[0].Rows[i]["name"].ToString();
}
}
How to add dynamic footer in dynamic Grid View with ASP.NET
This code use after Binding a gridview.
GridViewRow footerRow = GridView1.FooterRow;
Label lbl = new Label();
lbl.Text = "Create Footer Row";
footerRow.Cells[2].Controls.Add(lbl);
Tuesday, May 24, 2011
How to set identity seed in SQL SERVER by QUERY
If u want next number is 5000
then set seed as:
DBCC CHECKIDENT (tablename, reseed, 4999)
then set seed as:
DBCC CHECKIDENT (tablename, reseed, 4999)
Thursday, April 21, 2011
How to reset web form "CONTROL in ASP.NET" after save data
//call this function after completion of insert query
ClearInputs(Page.Controls);
private void ClearInputs(ControlCollection ctrls)
{
foreach (Control ctrl in ctrls)
{
if (ctrl is TextBox)
{
((TextBox)ctrl).Text = string.Empty;
}
else if (ctrl is DropDownList)
{
((DropDownList)ctrl).ClearSelection();
}
ClearInputs(ctrl.Controls);
}
}
ClearInputs(Page.Controls);
private void ClearInputs(ControlCollection ctrls)
{
foreach (Control ctrl in ctrls)
{
if (ctrl is TextBox)
{
((TextBox)ctrl).Text = string.Empty;
}
else if (ctrl is DropDownList)
{
((DropDownList)ctrl).ClearSelection();
}
ClearInputs(ctrl.Controls);
}
}
Tuesday, April 5, 2011
select gridview(template column) row index on button click
GridViewRow row = ((Button)sender).Parent.Parent as GridViewRow;
int index = row.RowIndex;
int index = row.RowIndex;
Subscribe to:
Posts (Atom)





