Sunday, March 11, 2012
Saturday, March 10, 2012
GET LATEST INDEX OF CHECKBOX LIST
string lastValue = string.Empty;
int lastIndex=0;
foreach (ListItem listitem in chkSec.Items)
{
if (listitem.Selected)
{
int thisIndex = chkSec.Items.IndexOf(listitem);
if (lastIndex < thisIndex)
{
lastIndex = thisIndex;
lastValue = listitem.Value;
}
}
}
Thursday, June 16, 2011
How to calculate difference between two date in ASP.NET with C#
TimeSpan tspan;
DateTime date1 = Convert.ToDateTime(txtDateFrom.Text);
DateTime date2 = Convert.ToDateTime(txtDateTo.Text);
if (date1 > date2)
tspan = date1.Subtract(date2);
else
tspan = date2.Subtract(date1);
int days = Convert.ToInt32(tspan.TotalDays);
How to get first day of month in ASP.NET
DateTime date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
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);
Subscribe to:
Comments (Atom)






