Last post Dec 30, 2016 05:25 AM by Eric Du
Dec 24, 2016 11:22 AM|Raghavendra32|LINK
As i am new to .Net i need help to solve my issue. Please help me out. I have a formview which is databound from code behind. Inside the Formview i have a Gridview which is bound to data in FormView_DataBound Event. Now the problem is that i need to fetch
the nested gridveiw datakey on click of a button inside the gridveiw. Please help me out. Thanks in advance.
Dec 24, 2016 12:29 PM|mohtshm|LINK
Plz put ur code and markup here to get more understanding of what u want to achieve
Dec 24, 2016 12:52 PM|Raghavendra32|LINK
Here is my code.
<asp:FormView ID="FV_CaseReg" runat="server" DataKeyNames="case_id" OnItemCommand="FV_CaseReg_ItemCommand"
OnModeChanging="FV_CaseReg_ModeChanging" OnDataBound="FV_CaseReg_DataBound" OnItemUpdating="FV_CaseReg_ItemUpdating">
...... Some Fields
.... Some Fields
<asp:GridView ID="GV_Attachments" runat="server" DataKeyNames="case_attachment_id,case_attachment_path" AutoGenerateColumns="false" AllowPaging="false" AllowSorting="false" ShowHeaderWhenEmpty="True" OnRowCommand="GV_Attachments_RowCommand" OnRowDeleting="GV_Attachments_RowDeleting" OnRowEditing="GV_Attachments_RowEditing" OnRowUpdating="GV_Attachments_RowUpdating">
...... Some Fields
<asp:LinkButton ID="LbtnGVCaseRegAttachmentDownload" runat="server" CommandName="Download" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>' ></asp:LinkButton>
I have a form view called FV_CaseReg, and inside it is a gridview called GV_Attachments. Gridview is bound by data in the Formview's DataBound event. Gridview has say 10 rows on click on the Gridview row i need to get the datakey of the gridview. When ever
the gridview button is clicked the Formview's ItemCommand event is triggered. So how to get the gridveiw's datakey?
Dec 30, 2016 05:25 AM|Eric Du|LINK
According to your description, you could try to accessing GridView from FormView RowDataBound Sender object, I think someone face the same problem as you, I hope that it will be helpful to you!
Get datakey multinested gridview: