ok ok

ok ok

  • NA
  • 34
  • 3.6k

Alert while clicking the button with matching the gridview l

Feb 4 2017 8:43 AM
Dear Experts,

I am trying to bring alert while i click the button if condition of "Gridview" label value is above zero. but its not working need your views.
 
my current code is 
 
  <asp:TemplateField HeaderText="AGREEDVSISSUED" >   <ItemTemplate>    <asp:label         ID="Literal4"         runat="server"         Text='<%# ok(Eval("agreed").ToString(), Eval("total_issued").ToString() )%>'>     </asp:label>
protected void Button1_Click(object sender, EventArgs e)     {         var countForZero = from GridViewRow gr in gvEmployeeDetails.Rows                            where (gr.FindControl("Literal4") as Label).Text.Equals("0")                            select gr;                       if (countForZero.ToList().Count < 0)                           {                 Messagebox("Messagebox Pop up Alert!!!");           }              BindGrid();     }     private void Messagebox(string Message)     {         Label lblMessageBox = new Label();         lblMessageBox.Text =             "<script language="'javascript'">" + Environment.NewLine +             "window.alert('" + Message + "')</script>";         Page.Controls.Add(lblMessageBox);     }
 

Answers (1)