Click here to Skip to main content
15,991,360 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Greetings from Devipriyanka.

I have created a repeater with 3 template like shown below:

XML
<asp:Repeater runat="server" OnItemDataBound="repeaterSearchResult_ItemDataBound" ID="repeaterSearchResult">
            <ItemTemplate>
                <asp:TextBox ID="textBoxSearch" runat="server" Text="<%#Container.DataItem%>"></asp:TextBox>
                <asp:Button ID="buttonAdd" runat="server" Text="Button"  OnClick="button_click"/>
                <asp:GridView ID="gridView" runat="server">
                    <%--And the Columns goes here--%>
                </asp:GridView>
            </ItemTemplate>

</asp:Repeater>




And this is how i bind the repeater:

private void LoadControls(string Flag)
        {
                LocationName.Clear();
                string htext = "";
                Updatesearch.Update();
                dynamicTextBoxes = new TextBox[Convert.ToInt32(Session["Count"])];
                dynamicButtons = new Button[Convert.ToInt32(Session["Count"])];
                dynamicGV = new GridView[Convert.ToInt32(Session["Count"])];
                int i;
                if (Flag == "L")
                {
                    htext = "PortOfDischargeName";
                    sql = "Select " + htext + " from VW_TransAIHBLMasterUpdateDetails  where tBLG_NUIsActive=1 and PortOfLoadName='" + Session["Loading"].ToString() + "' group by  PortOfDischargeName";
                   
                }
                else if (Flag == "D")
                {
                    htext = "PortOfLoadName";
                    sql = "Select " + htext + " from VW_TransAIHBLMasterUpdateDetails  where tBLG_NUIsActive=1 and PortOfDischargeName='" + Session["Destination"].ToString() + "' group by  PortOfLoadName";
                    
                }
                else
                {
                    sql = "";
                }
                SqlDataReader rdr = mobjGenlib.objDBLib.ExecuteQueryReader(sql.ToString());
                while (rdr.Read())
                {
                    LocationName.Add(rdr.GetValue(0).ToString());
                }
                rdr.Close();
                repeaterSearchResult.DataSource = LocationName;
                repeaterSearchResult.DataBind();
        }


Based on my code the textbox will be generate.
for eg: my code returns 3 then 3 textbox will be created.
My gridview will bind based on the value in the textbox.
now what i need is i want to know how to read the third textbox value.

can any one please help me to solve this...
Thanks in adcance
Posted
Updated 30-Jun-14 0:09am
v2

1 solution

Read here to understand the control creation mechanism inside data-repeater:
Understanding ASP.NET Templates[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900