I am facing a slight problem with both events clashing with one another.
I have a column displaying a link button, so that when user clicks on it, it would direct them to another page displaying the data in the specific row of the datagrid.
Below the datagrid, I have number pages, which just so happens to be a link button as well and when user clicks on page 2, it would display the page 2 data of the datagrid.
The problem now is that, when I want to click to page 2, it would redirect to the next page, which is the event of my ItemCommand.
Are there any ways of which I could make the datagrid differentiate, which is the correct link button to read,
So that both of them do not clash with one another??
protected void RPYGrid_ItemSelect(object sender, DataGridCommandEventArgs e) { DataSet dsGenRequestPayment = new DataSet(); dsGenRequestPayment = GenerateRequestPayment(); DataTable dtRequest = new DataTable(); dtRequest = dsGenRequestPayment.Tables[0];
if (((LinkButton)e.CommandSource).CommandName == "ItemSelect")
{
try
{
int iIndex = e.Item.DataSetIndex;
string sId = RPYGrid.DataKeys[iIndex].ToString();
foreach (DataRow drRequest in dtRequest.Rows)
{
string sRequestID = drRequest["RequestNo"].ToString();
if (sId == sRequestID)
{
sRequestNo = drRequest["RequestNo"].ToString();
sAmount = drRequest["RequestAmt"].ToString();
sAttachment = drRequest["FilePath"].ToString();
sReqCompanyID = drRequest["RequestCompanyID"].ToString();
sPayCompanyID = drRequest["PayerCompanyID"].ToString();
sReqCoName = drRequest["RequestCoName"].ToString();
sPayCoName = drRequest["PayerCoName"].ToString();
sRequestDate = drRequest["RequestDt"].ToString();
}
}
dtRequest.Clear();
dsGenRequestPayment.Clear();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
}
protected void RPYGrid_PageIndexChanged(object sender, DataGridPageChangedEventArgs e)
{
RPYGrid.CurrentPageIndex = e.NewPageIndex;
GenerateRequestData();
}