this my button clcik i am getting the row index value in 7th line
C#
protected void lnkbtnView_Click(object sender, EventArgs e)
{
try
{
LinkButton button = sender as LinkButton;
DataTable dt = new DataTable();
int rowindex = Convert.ToInt32(button.CommandArgument.ToString());
dt = obank.GetMerchantBankDetails();
lblBenId.Text = dt.Rows[0]["BeneficiaryID"].ToString();
lblBenCode.Text = dt.Rows[0]["BeneficiaryCode"].ToString();
lblBenName.Text = dt.Rows[0]["BeneficiaryName"].ToString();
lblAccountNumber.Text = dt.Rows[0]["AccountNumber"].ToString();
lblIFSC.Text = dt.Rows[0]["IFSC"].ToString();
lblNameAsPerBank.Text = dt.Rows[0]["NameAsPerBank"].ToString();
ScriptManager.RegisterStartupScript(UPDP_MerchantBanks, UPDP_MerchantBanks.GetType(), "ErrorMSg", "ShowMainDialog();", false);
}
catch (Exception Exception)
{
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMSg", "ShowErrorDialog('" + Exception.Message.ToString() + "')", false);
}
catch (Exception ex)
{
oExceptionManager.LogError(ex.Message, " -- In lnkView_Click Function in Users.aspx.cs");
}
}when i click 133 or 122 i am getting 100 values in my modal popup

when i click on action suppose if i click on 2 row or 3 or 4 i am getting the values of 1st row only im not getting values which i need to display in modalpop for all the row click it is displaying only first row values
my sp how can i resolve this?? help me
SQL
CREATE procedure usp_GetMerchantBankDetails
as
begin
begin try
select * from MerchantBanks
end try
begin catch
select ERROR_MESSAGE()
INSERT INTO Application_Error_Log(ErrorMessage,FromPage,Createdon) VALUES(ERROR_MESSAGE(),'usp_InsertMerchantBanks',GETDATE())
end catch
end
Amit MohantyRank #112 · 20K reputationPosted May 3, 2023, 6:42 AM EDT
In your
obank.GetMerchantBankDetails()method as well as in yourusp_GetMerchantBankDetailsprocedure you have to pass BeneficiaryId to get the particular bank details. In your current code you are fetching all MerchantBanks and showing the first record.protected void lnkbtnView_Click(object sender, EventArgs e) { try { LinkButton button = sender as LinkButton; int rowindex = Convert.ToInt32(button.CommandArgument.ToString()); GridViewRow row = MyGridView.Rows[rowindex]; string beneficiaryId = row.Cells[0].Text; // Assumes the "BeneficiaryId" column is the first column in the GridView DataTable dt = obank.GetMerchantBankDetails(beneficiaryId); // Clear any previously displayed data lblBenId.Text = ""; lblBenCode.Text = ""; lblBenName.Text = ""; lblAccountNumber.Text = ""; lblIFSC.Text = ""; lblNameAsPerBank.Text = ""; // Display data for the clicked row lblBenId.Text = dt.Rows[0]["BeneficiaryID"].ToString(); lblBenCode.Text = dt.Rows[0]["BeneficiaryCode"].ToString(); lblBenName.Text = dt.Rows[0]["BeneficiaryName"].ToString(); lblAccountNumber.Text = dt.Rows[0]["AccountNumber"].ToString(); lblIFSC.Text = dt.Rows[0]["IFSC"].ToString(); lblNameAsPerBank.Text = dt.Rows[0]["NameAsPerBank"].ToString(); // Show the modal popup ScriptManager.RegisterStartupScript(UPDP_MerchantBanks, UPDP_MerchantBanks.GetType(), "ErrorMSg", "ShowMainDialog();", false); } catch (Exception Exception) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ErrorMSg", "ShowErrorDialog('" + Exception.Message.ToString() + "')", false); } catch (Exception ex) { oExceptionManager.LogError(ex.Message, " -- In lnkView_Click Function in Users.aspx.cs"); } }CREATE procedure usp_GetMerchantBankDetails (@beneficiaryId INT) as begin begin try select * from MerchantBanks WHERE BeneficiaryId = @beneficiaryId end try begin catch select ERROR_MESSAGE() INSERT INTO Application_Error_Log(ErrorMessage,FromPage,Createdon) VALUES(ERROR_MESSAGE(),'usp_InsertMerchantBanks',GETDATE()) end catch endJaya PrakashRank #1,293 · 1.3K reputationPosted May 3, 2023, 8:22 AM EDT
Getting Exception Input string was not in correct format