읽기 전용 모드로 설정하거나 기능을 영원히하지 않게하려면 사용하지 않으려합니다.gridview asp.net의 특정 행에서 링크를 비활성화/회색으로 표시
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="btnApprove" runat="server" Text="Approve" CommandName="Approve" CommandArgument='<%# Eval("ProductID") %>' />
</ItemTemplate>
</asp:TemplateField>
그리고 그것은 다음과 같습니다 : 내가 뭘해야하는 것은 이것이다 내가 승인 링크 버튼을 클릭하면 example image
지금 내가 원하는 무엇인가, 그것은 다음 회색 또는 그 기능을 잃게됩니다. 그러나 내가 그랬 으면을 클릭했다. 내가 어떻게 할 수 있는지에 대한 어떤 트릭이 있나? 그런데 여기에 뒤에 내 코드는 다음과 같습니다
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
CheckBox chkRow = (row.Cells[0].FindControl("chkCtrl") as CheckBox);
if (chkRow.Checked)
{
using (SqlConnection scn = new SqlConnection("Data Source = 'PAULO'; Initial Catalog=ShoppingCartDB;Integrated Security =True"))
{
scn.Open();
SqlCommand cmd = new SqlCommand("update o set o.Updatedproduct = p.ProductQuantity - o.Totalproduct from CustomerProducts o inner join Products p on o.ProductID = p.ProductID WHERE [email protected]", scn);
cmd.Parameters.AddWithValue("@CustomerID", SqlDbType.Int).Value = row.Cells[0].Text;
cmd.ExecuteNonQuery();
Label1.Visible = true;
Label2.Visible = false;
GridView1.DataBind();
}
}
}
}
}
UPDATE : 내가, 내가 또한 가능하면 전체 행이 회색으로 표시되고 고려해 제공되는 이미지를 기반으로
. 그 잉크 버튼 후에는하는 LinkButton을 찾아 다음과 같이 사용하지 않도록 설정해야
이들 중 하나를 사용하는 방법에 대해 무엇을 :'e.Row.Attributes e.Row.CssClass' – Legends
어디 내가 그것을 선생님을 배치해야합니까? cssclass에서 무엇을 얻을 수 있습니까? – faufao