How can I check that checkbox is checked or not inside grid view without using loop--
Actually i want to work like onrowcommand
this is checkbox inside gridview-------
CommandName="chkboxselect" AutoPostBack="true" CommandArgument='<%# Eval("hnysku") %>' />
this is C# code which is working like onrowcommand but here is another problem how can i check checkbox is checked or not ---
List list = new List();
var chk = (CheckBox)sender;
var CommandName = chk.Attributes["CommandName"];
if (CommandName == "chkboxselect")
{
var CommandArgument = chk.Attributes["CommandArgument"];
if (Convert.ToBoolean(chk.Attributes["Checked"]) == true)
{
list.Add(CommandArgument);
}
else
{
list.Remove(CommandArgument);
}
}
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Vikas JhaPosted Sep 13, 2020, 12:18 PM
where ((CheckBox)msgRow.FindControl("chkUpdateStatus")).Checked
select Int32.Parse(messagesGrid.DataKeys[msgRow.RowIndex].Value.ToString());
You can also check the article.
https://www.c-sharpcorner.com/UploadFile/20abe2/get-row-cell-value-from-grid-view-of-checked-checkbox-in-asp/