ASP.NET 自定义控件和 Page.Request.Form[]
我有一个继承自 System.Web.UI.Control 的控件,并包含通用 HTML 控件而不是 asp.net 服务器端控件。我使用 Page.Request.Form[Control_id] 来获取其中一个控件的值。如果我有一个包含这些自定义控件的列的 gridview,并且我添加一个新行 [row6],然后从该行 [row3] 上方删除一行,则这基本上可以接受,新行中的控件 [row6 成为 row5]假定紧邻其上方的行的值 [row5 变为 row4]。
我相信这是因为我使用 Page.Request.Form[] 来获取每个控件的值,但我的控件不知道这些值属于先前占用同一行的控件。我该如何解决这个问题?我会很感激任何建议!
I have a control that inherits from System.Web.UI.Control and contains generic HTML controls rather than asp.net server side controls. I use Page.Request.Form[Control_id] to get the value of one of the controls. This basically works accept if I have a gridview that contaiins a column of these custom controls and I add a new row [row6] and then delete a row from above tht row [row3], the control in the new row [row6 becoming row5] assumes the value of the row immediately above it [row5 becomming row4].
I beleive this is because I use Page.Request.Form[] to get the value for each control but my control doesnt know that those values belonged to controls that had previously occupied the same row. How do I fix this? I'd aprreciate any suggestions!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要弄乱
Page.Request.Form
集合。您需要的是适当的复合控制。这是一个简单的例子:You don't need to mess with the
Page.Request.Form
collection. What you need is a proper composite control. Here's a simple example: