如何获取文本框(内部转发器)值。 [英] how to get the textbox (inside repeater) value.

查看:83
本文介绍了如何获取文本框(内部转发器)值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




来自Devipriyanka的问候。



我创建了一个带有3个模板的转发器,如下所示:



Hi
Greetings from Devipriyanka.

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

<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这就是我绑定转发器的方式:







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();
        }





根据我的代码生成文本框。

例如:my代码返回3然后将创建3个文本框。

我的gridview将根据文本框中的值进行绑定。

现在我需要的是我想知道如何阅读第三个文本框值。



任何人都可以帮我解决这个问题...

感谢adcance



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

推荐答案

请阅读此处以了解数据中继器内部的控件创建机制:

了解ASP.NET模板 [ ^ ]
Read here to understand the control creation mechanism inside data-repeater:
Understanding ASP.NET Templates[^]


这篇关于如何获取文本框(内部转发器)值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆