<asp:GridView ID="grdNotiSearch" runat="server" Width="100%"
PageSize="10" AutoGenerateColumns="false"
DataKeyNames="Upload_Code,UPLOAD_TYPE,UPLOAD_DESC,MESSAGE,DISPL_FLASH,DISPL_HOME,LINK_DISPLAY,
NOTI_CODE,NOTI_NUM,NOTI_DATE"
OnRowCreated="grdNotiSearch_RowCreated"
OnRowCommand="grdNotiSearch_RowCommand"
OnPageIndexChanging="grdNotiSearch_PageIndexChanging"
EmptyDataText="Records Not Found..!"
onselectedindexchanged="grdNotiSearch_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="NOTI_NUM" HeaderText="Noti Code" Visible="false" />
<asp:BoundField DataField="Noti_Num" HeaderText="Notification">
<ItemStyle HorizontalAlign="Left" Width="25%" CssClass="GridViewItemStyle" />
<HeaderStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Noti_Date" HeaderText="Date">
<ItemStyle HorizontalAlign="Center" Width="10%" />
<HeaderStyle HorizontalAlign="Center"/>
</asp:BoundField>
<asp:BoundField DataField="UPLOADS" HeaderText="Result Description">
<ItemStyle HorizontalAlign="left" Width="55%" />
<HeaderStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Act_Stat" HeaderText="Active">
<ItemStyle HorizontalAlign="Center" Width="10%" />
<HeaderStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnEdit" runat="server" Width="45px" Text="EDIT" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="Edit" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnClick" runat="server" Width="45px" Text="TEST" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="Test" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField >
<ItemStyle HorizontalAlign="Center" Width="3%" />
<HeaderStyle HorizontalAlign="Center" />
</asp:BoundField>
</Columns>
<HeaderStyle CssClass="GridViewHeaderStyle" />
<RowStyle CssClass="GridViewRowStyle" />
<AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
<PagerStyle CssClass="GridViewPagerStyle" />
<EmptyDataRowStyle CssClass="GridViewEmptyRowStyle" />
<SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
</asp:GridView>
[EDIT - CHill60 - OP Code from comment]
protected void grdNotiSearch_RowCommand(object sender, GridViewCommandEventArgs e)
{
try
{
if (e.CommandName == "Edit")
{
int index = Convert.ToInt32(e.CommandArgument.ToString());
string noticodes = grdNotiSearch.DataKeys[index]["NOTI_CODE"].ToString();
string uploadcodes = grdNotiSearch.DataKeys[index]["Upload_Code"].ToString();
string UploadType = grdNotiSearch.DataKeys[index]["UPLOAD_TYPE"].ToString();
lblMessage.Text = "";
string encryptedString = Encrypt("" + noticodes + "");
string encryptedString1 = Encrypt("" + uploadcodes + "");
lblMessage.Text = "";
encryptedString = Encrypt("" + noticodes + "");
encryptedString1 = Encrypt("" + uploadcodes + "");
Response.Redirect("ResultDBSearchNew.aspx?" + encryptedString + "," + encryptedString1 + "");
}
if (e.CommandName == "Test")
{
int index = Convert.ToInt32(e.CommandArgument.ToString());
string noti = Convert.ToString(e.CommandArgument.ToString());
int rowIndex = int.Parse(e.CommandArgument.ToString());
string val = grdNotiSearch.DataKeys[index]["NOTI_CODE"].ToString();
string noticodes = grdNotiSearch.DataKeys[index]["NOTI_CODE"].ToString();
string uploadcodes = grdNotiSearch.DataKeys[index]["Upload_Code"].ToString();
string UploadType = grdNotiSearch.DataKeys[index]["UPLOAD_TYPE"].ToString();
lblMessage.Text = "";
string encryptedString = Encrypt("" + noticodes + "");
string encryptedString1 = Encrypt("" + uploadcodes + "");
if (UploadType == "4")
{
Response.Redirect("~/Modules/TestPages/ApplicationStatus/ApplicationIndex.aspx?" + encryptedString + "," + encryptedString1 + "");
}
else if (UploadType == "5")
{
Response.Redirect("~/Modules/TestPages/WrittenTestResult/WrittenTestResult.aspx?" + encryptedString + "," + encryptedString1 + "");
}
else if (UploadType == "6")
{
Response.Redirect("~/Modules/ApplicationStatus/PETResult/PETResult.aspx?" + encryptedString + "," + encryptedString1 + "");
}
else if (UploadType == "7")
{
Response.Redirect("~/Modules/TestPages/DocVerifySchedule/DocumentVerifyResult.aspx?" + encryptedString + "," + encryptedString1 + "");
}
else if (UploadType == "8")
{
Response.Redirect("~/Modules/TestPages/Panel/PanelResult.aspx?" + encryptedString + "," + encryptedString1 + "");
}
else if (UploadType == "9")
{
Response.Redirect("~/Modules/TestPages/ExServicemen/ExServicemenDVStatusResult.aspx?" + encryptedString + "," + encryptedString1 + "");
}
else if (UploadType == "10")
{
Response.Redirect("~/Modules/TestPages/ExServicemen/PanelExServiceResult.aspx?" + encryptedString + "," + encryptedString1 + "");
}
else if (UploadType == "11")
{
Response.Redirect("~/Modules/TestPages/CallLetter/AppDisplayTest.aspx?" + encryptedString + "," + encryptedString1 + "");
}
}
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
}
}