Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Repeater Control as a command parameter for a nested gridview
    primarykey
    data
    text
    <p>I have a repeater which contains a nested gridview. Now I need to be able to retrieve a value databound in a label inside of a repeater and use it as an input parameter for the gridview. </p> <p>Here is some code which will hopefully give you a better idea of what I'm trying to do. </p> <pre><code>enter code here &lt;asp:Repeater ID="Repeater1" runat="server" DataSourceID="RepeaterDS" OnItemDataBound="Repeater1_SendRollNumber"&gt; &lt;HeaderTemplate&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;table style="width: 615px;" id="Table1"&gt; &lt;tr&gt; &lt;td&gt; &lt;b&gt;Roll #:&lt;/b&gt; &lt;asp:Label runat="server" ID="RollIDLabel" Text='&lt;%# Eval("RollID") %&gt;' /&gt; &lt;asp:Label runat="server" ID="RollIDLabelCode" Text='&lt;%# Eval("RollID") %&gt;' Visible="false" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;b&gt;Address:&lt;/b&gt; &lt;asp:Label runat="server" ID="AddressLabel" Text='&lt;%# Eval("Address") %&gt;' /&gt; &lt;/table&gt; &lt;asp:Label ID="Label1" runat="server"&gt;&lt;b&gt;Parties:&lt;/b&gt;&lt;/asp:Label&gt; &lt;asp:GridView ID="GridView3" runat="server" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" AllowPaging="True" Width="620px" DataSourceID="AssessmentDetailsFromRollIDDS" EmptyDataText="None Associated" AutoGenerateColumns="False" ShowFooter="true"&gt; &lt;asp:TemplateField HeaderText="Property Assessment" HeaderStyle-Font-Bold="true" FooterStyle-BackColor="White"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="PropAssessType" runat="server" Width="90%" Text='&lt;%# Eval("PropertyAssessmentType") %&gt;'&gt;&lt;/asp:Label&gt; &lt;asp:Label ID="PropAssessDsc" runat="server" Text='&lt;%# Eval("PropertyAssessmentDesc") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;/FooterTemplate&gt; &lt;/asp:TemplateField&gt; &lt;RowStyle BackColor="#F7F7DE" /&gt; &lt;FooterStyle BackColor="#CCCC99" /&gt; &lt;PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" /&gt; &lt;SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" /&gt; &lt;HeaderStyle BackColor="#3E4E4E" Font-Bold="True" ForeColor="White" /&gt; &lt;AlternatingRowStyle BackColor="White" /&gt; &lt;/asp:GridView&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;asp:ObjectDataSource ID="RepeaterDS" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetRollNumberbyAppealID" TypeName="BusinessLayer.BSO.Roll_AssessmentDetailsBSO"&gt; &lt;SelectParameters&gt; &lt;asp:QueryStringParameter Name="AppealID" QueryStringField="appealID" Type="Int32" /&gt; &lt;/SelectParameters&gt; &lt;/asp:ObjectDataSource&gt; &lt;asp:ObjectDataSource ID="AssessmentDetailsFromRollIDDS" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetAssessDetailsFromRollID" OnSelecting="AssessmentDetailsFromRollIDDS_Selecting" TypeName="BusinessLayer.BSO.Assessment_DetailsBSO"&gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter Name="RollID" ControlID="RollIDLabelCode" Type="String" /&gt; &lt;/SelectParameters&gt; &lt;/asp:ObjectDataSource&gt; </code></pre> <p>I've tried to cut out as much code as possible while leaving the guts of the problem in. So I basically want the label control RollIDLabelCode which is located in a repeater to also be an input into my gridview. The problem is that I keep getting errors such as can't find the control RollIDLabelCode. I've heard there is a bug in which you need to specify all naming containers. which I've tried with no luck. </p> <p>Another route I've tried is doing this in the code behind. </p> <pre><code>enter code here public void Repeater1_OnItemDataBound(Object Sender, RepeaterItemEventArgs e) { // Execute the following logic for Items and Alternating Items. if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { string test = ((Label)e.Item.FindControl("RollIDLabel")).Text; } } public void AssessmentDetailsFromRollIDDS_OnSelecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["RollID"] = "Need the Info here"; } </code></pre> <p>These functions are called on the repeater being databound and the objectdatasource onselecting function. And these work separately very well. I just need to know how to get the information from the string test in the Repeater1_OnItemDataBound function to the e.InputParameters["RollID"] in the OnSelecting function.</p> <p>Hopefully someone knows how to do this. I am new to .net programming. I appreciate any help.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload