我想要獲取表單視圖中的所有綁定到對象數據源的中繼器內的文本框的值。從表單視圖中的中繼器中獲取數據
<asp:FormView ID="FormView1" runat="server" AllowPaging="True"
DataKeyNames="Id" EnableViewState="False"
OnPageIndexChanging="FormView1_PageIndexChanging"
onitemupdated="FormView1_ItemUpdated"
OnItemUpdating="FormView1_ItemUpdating" ondatabound="FormView1_DataBound">
<ItemTemplate>
<asp:TextBox ID="txtProdName" runat="server" Text='<%#Eval("ManufacturerProductName") %>'></asp:TextBox>
<asp:Repeater ID="Repeater1" runat="server" DataSource='<%#DataBinder.Eval(Container.DataItem,"Distributors") %>'>
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" ontextchanged="onTextChanged" Text='<%# DataBinder.Eval(Container.DataItem, "FobCost")%>'></asp:TextBox>
<asp:Repeater ID="Repeater2" runat="server" DataSource='<%# DataBinder.Eval(Container.DataItem,"PricingsheetWarehouses") %>'>
<ItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" ontextchanged="onTextChanged" Text='<%# DataBinder.Eval(Container.DataItem, "DeliveredCost")%>'></asp:TextBox>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:FormView>
我得到txtProdName因爲這
TextBox t=FormView1.FindControl("txtProdname")as textBox;
,但我不能用它來得到它給我空 任何幫助中繼器內文本框?
是啊,這一個返回T作爲空... – user780975
在此情況下不把這個碼?第一條語句必須在'FormView'綁定事件中,第二條語句在'repeater'綁定事件中。 –
我編輯我的答案檢查它。 –