- 我想要做的是從TextBox1中訪問該值以顯示回屏幕上。
- 我試圖從Page_Load()和OnItemDataBound訪問它,它們都失敗了。
看起來代碼能夠訪問控件,但它不返回任何內容。如何訪問Repeater FooterTemplate TextBox?
保護無效的Page_Load(對象發件人,EventArgs的){
Literal Literal1 = (Literal)Repeater1.Controls[Repeater1.Controls.Count - 1].FindControl("Literal1"); Response.Write(Literal1.Text); //this techique is not working for the line below TextBox TextBox1 = (TextBox)Repeater1.Controls[Repeater1.Controls.Count - 1].FindControl("TextBox1"); Response.Write(TextBox1.Text); } public void myRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { //this techique is not working if (e.Item.ItemType == ListItemType.Footer) { TextBox TextBox1 = (TextBox)e.Item.FindControl("TextBox1"); Response.Write(TextBox1.Text); } }
0
A
回答
1
我不知道你所說的「他們都失敗了」,但如果文本框的Text屬性爲空是什麼意思我可能是因爲你在每個帖子後面都重寫了你的中繼器。嘗試使用!IsPostBack條件包裝您的中繼器.DataBind()。
0
我必須使用「文字」作爲替代解決方案通過傳遞HTML文本框問題。我不喜歡這個解決方案,但我想我必須使用它。
相關問題
- 1. 如何訪問Repeater的項目隨機
- 2. 我如何獲得訪問gridview/repeater
- 3. 從Repeater內提交TextBox
- 4. 如何從「程序」類訪問TextBox「textBox2」?
- 5. javascript中的gridview的footertemplate中的訪問標籤
- 6. 如何更改Repeater DataSourceID?
- 7. 訪問Repeater中HTML表格的問題
- 8. 訪問來自父Repeater外部的SiteMapNode Container.DataItem
- 9. Kendo footertemplate
- 10. Asp.Net Repeater如何找到TextBox「TextChanged」事件的另一個控件
- 11. 如何從包含UserControls的Repeater獲取所有TextBox值?
- 12. 如何從Repeater獲取更新的Textbox值?
- 13. 在Repeater HeaderTemplate中訪問超鏈接服務器控件
- 14. GridView onRowUpdating事件訪問textBox
- 15. 在ContextMenu中訪問TextBox
- 16. Textbox字段名稱訪問
- 17. 訪問DataTemplate中的TextBox
- 18. 訪問一個TextBox arrary
- 19. 如何訪問Repeater內的外部元素?
- 20. 如何使用jquery從Repeater獲取/訪問行值?
- 21. 如何訪問Repeater內的元素屬性?
- 22. 如何在QML中訪問Repeater兒童的屬性?
- 23. 如何訪問repeater1_ItemDataBound中的Repeater的DataItem值
- 24. gridview中的footertemplate
- 25. 如何獲取頁腳使用嵌套Repeater的代碼後面的項目值?
- 26. Databinding Repeater問題
- 27. 如何訪問任何其他Web應用程序的TextBox?
- 28. 如何找到Repeater Control中的控件?
- 29. 如何從MainActivity訪問和更新片段組件(SeekBar,TextBox等)?
- 30. 如何訪問ListBox中的TextBox itemsSource是Datatemplate?
你能顯示你的html嗎? – Lareau
<表格ID = 「form1的」 RUNAT = 「服務器」> 的 ItemTemplate中> Enter you text in the below to test. asp:Literal> FooterTemplate> asp:Repeater> –
stackoverflow編輯器出錯。無法將代碼粘貼到原始帖子中。 –