<asp:gridview id="grid_symptom" cssclass="grid" autogeneratecolumns="False" runat="server" xmlns:asp="#unknown">
DataKeyNames="symptom_id"
OnRowDeleting="grid__symptom_RowDeleting" OnRowEditing="grid_symptom_RowEditing"
OnRowCancelingEdit="grid_symptom_RowCancelingEdit" OnRowUpdating="grid_symptom_RowUpdating"
PageSize="3" AllowPaging="True"
OnPageIndexChanging="grid_symptom_PageIndexChanging">
<alternatingrowstyle backcolor="Beige" />
<pagerstyle cssclass="paging" horizontalalign="Center" />
<columns>
<asp:templatefield headertext="Symptoms">
<edititemtemplate>
<asp:textbox id="txt_edit_symptom" runat="server" text="<%#Eval ("symptom_name") %>"></asp:textbox>
</edititemtemplate>
<itemtemplate>
<asp:label id="lbl_item_symptom" runat="server" text="<%#Eval ("symptom_name") %>"></asp:label>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Action">
<edititemtemplate>
<asp:imagebutton id="Imgbtn_symptom_Update" commandname="Update" runat="server" imageurl="~/Admin/images/update1.jpg">
ToolTip="Update" />
<asp:imagebutton id="Imgbtn_symptom_Cancel" runat="server" commandname="Cancel" imageurl="~/Admin/images/cancel1.jpg">
ToolTip="Cancel" />
</asp:imagebutton></asp:imagebutton></edititemtemplate>
<itemtemplate>
<asp:imagebutton id="Imgbtn_symptom_edit" commandname="Edit" tooltip="Edit" imageurl="~/Admin/images/edit2.png">
runat="server" />
<asp:imagebutton id="Imgbtn_symptom_delete" commandname="Delete" tooltip="Delete" imageurl="~/Admin/images/delete2.png">
OnClientClick="return confirm('Are you sure,Do you want to delete this Symptoms?');"
runat="server" />
</asp:imagebutton></asp:imagebutton></itemtemplate>
</asp:templatefield>
</columns>
<headerstyle cssclass="gridHeader" />
<footerstyle backcolor="Black" />
<rowstyle cssclass="gridRow" />
<pagersettings firstpagetext="<br" mode="hold" />
protected void grid__symptom_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
MessageHide();
int i = 0;
try
{
int symptomid = int.Parse(grid_symptom.DataKeys[e.RowIndex].Values[0].ToString());
bo.Symptom_id= symptomid;
i = bl.Deletesymptom(bo);
}
catch (Exception ex)
{
ex.ToString();
}
if (i > 0)
{
divDeleteSuc.Visible = true;
}
else
{
divDeleteUsuc.Visible = true;
}
bindgridsymptom();
}
protected void grid_symptom_RowEditing(object sender,GridViewEditEventArgs e)
{
grid_symptom.EditIndex = e.NewEditIndex;
MessageHide();
bindgridsymptom();
}
protected void grid_symptom_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
grid_symptom.EditIndex = -1;
MessageHide();
bindgridsymptom();
}
protected void grid_symptom_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
MessageHide();
int i = 0;
try
{
TextBox txtsymptom = (TextBox)grid_symptom.Rows[e.RowIndex].FindControl("txt_edit_symptom");
int symptomid= int.Parse(grid_symptom.DataKeys[e.RowIndex].Values[0].ToString());
bo.Symptom_id = symptomid;
bo.Symptom_nm = txtsymptom.Text;
i = bl.Updatesymptom(bo);
}
catch (Exception ex)
{
ex.ToString();
}
if (i > 0)
{
divGridUpdateSuc.Visible = true;
}
else
{
divGridUpdateUSuc.Visible = true;
}
grid_symptom.EditIndex = -1;
bindgridsymptom();
}
protected void grid_symptom_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grid_symptom.PageIndex = e.NewPageIndex;
MessageHide();
bindgridsymptom();
}