[英]First row of DataGrid is not finding on ItemDataBound in Asp.net c#
I have a DataGrid
where i am not able to find first row of the DataGrid
on ItemDataBound
. 我有一个
DataGrid
,无法在ItemDataBound
上找到DataGrid
第一行。
its working fine With other continues rows. 其工作正常与其他继续行。
CS
code of ItemDataBound
is - ItemDataBound
CS
代码为-
protected void DgrMemberList_ItemDataBound(object sender, DataGridItemEventArgs e)
{
foreach (DataGridItem item in DgrMemberList.Items)
{
HtmlAnchor aDelivery = e.Item.FindControl("aDelivery") as HtmlAnchor;
if (e.Item.Cells[2].Text.ToString() == "STK")
{
aDelivery.HRef = "CreateDownloadImageSubmit.aspx?OID=" + e.Item.Cells[0].Text;
}
else
{
aDelivery.HRef = "javascript:void(0);";
}
}
}
Please help me out with this issue. 请帮我解决这个问题。 Thanks
谢谢
First you don't need to use loop in DgrMemberList_ItemDataBound
. 首先,您不需要在
DgrMemberList_ItemDataBound
使用循环。 This event will be execute for every row in your grid. 此事件将对网格中的每一行执行。
protected void DgrMemberList_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Row.DataItem == null)
return;
HtmlAnchor aDelivery = e.Item.FindControl("aDelivery") as HtmlAnchor;
if (e.Item.Cells[2].Text.ToString() == "STK")
{
aDelivery.HRef = "CreateDownloadImageSubmit.aspx?OID=" + e.Item.Cells[0].Text;
}
else
{
aDelivery.HRef = "javascript:void(0);";
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.