You must Sign In to post a response.
Category: .NET
#768378
Hi,
Try this:
Try this:
foreach (DataGridViewRow r in dgvMain.Rows)
{
DataGridViewLinkCell lc = new DataGridViewLinkCell();
lc.Value = r.Cells[0].Value;
}
#768386
You can use this example of code snippet add checkboxes in asp.net and get gridview selected rows data on button click in asp.net
public partial class BindGridviewwithCheckboxes : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
BindGridviewData();
}
}
protected void BindGridviewData()
{
DataTable dt = new DataTable();
dt.Columns.Add("UserId", typeof(Int32));
dt.Columns.Add("UserName", typeof(string));
dt.Columns.Add("Education", typeof(string));
dt.Rows.Add(1, "Suresh Dasari", "B.Tech");
gvDetails.DataBind();
}
#768389
label values means ? do you want to show the sum of all rows or any specific columns ? what you want to show in footer
here is a small code snippet to show values in gridview footer
Thanks
Koolprasd2003
Editor, DotNetSpider MVM
Microsoft MVP 2014 [ASP.NET/IIS]
here is a small code snippet to show values in gridview footer
protected void GridDataBound(object sender, EventArgs e)
{
GridView grid = (GridView)sender;
DataTable source = (DataTable)grid.DataSource;
decimal totalSum = source.AsEnumerable().Sum(r => r.Field<decimal>("Total"));
labelOverall.Text = totalSum.ToString();
}
Thanks
Koolprasd2003
Editor, DotNetSpider MVM
Microsoft MVP 2014 [ASP.NET/IIS]
Return to Return to Discussion Forum