AJAX TabContainer的FormView控件内不插入值 [英] AJAX Tabcontainer inside formview not inserting values

查看:260
本文介绍了AJAX TabContainer的FormView控件内不插入值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据绑定FormView控件(以present按类别前的信息:客户端生物数据,健康史,财务细节...)内的TabContainer的。更新和FormView控件的插入不工作(发布NULL值到数据库) - 我猜的FormView无法找到选项卡容器的标签面板内的文本框。

I have a TabContainer inside a data bound FormView (to present the information by category ex: Client Bio data, health history, financial details...). The Update and Insert of the formView doesn't work (posting NULL values to the database) - I guess the FormView cannot find the TextBoxes inside the tab container's tab panels.

一些论坛说,这是因为TabContainer的的实现(设计)的作INamingContainer,而黑客就是利用的TabContainer的控制 来源$ C ​​$ C(阿贾克斯CTL工具包的源$ C ​​$ c)和去除它的作INamingContainer接口...太复杂,我的口味......我有点失去了。

Some of the forums say that it's because of the TabContainer's implementation (by design) of "INamingContainer", and a hack is to take control of the TabContainer's source code (ajax ctl toolkit's source code) and remove the "INamingContainer" interface from it... Too complicated to my taste .. I'm kinda lost.

那么有没有一种简单的和更好的方法来解决这一问题?我眼花缭乱地看到,该工具包未能实现这一基本functionnality对于大多数developper订购信息(选项卡控件)与FormView控件是共同的需要。

Well is there a straight forward and better way to fix this? I'm dazzled to see that the toolkit has failed to implement this basic functionnality as for most developper ordering info (tab control) with formview is a common need.

在此先感谢, Jeewai

Thanks in advance, Jeewai

推荐答案

回答我自己的线程...我得到了一些伟大的内部与asp.net论坛和决定张贴在这里的解决方案:再现,帮助我走出解释

Answering my own thread... I got some great inside from the asp.net forum and decided to post the solution here: Reproducing the explanation that helped me out:

希望这将清除出一些问题,其他用户谁可能会遇到同样的问题。

Hope that will clear out some questions to other users who may encounter the same issue.

最好的, JY

块引用   嗨JY,

简短的回答是,绑定语句进行编译时,有对的插入/更新提取值一定的局限性。如果FormView控件中的控件然后在另一个命名容器(TabContainer的和一个tabpanel都是命名容器),那么编译器无法解析如何提取文本框中的值。我对此有更详细的讨论在我的博客上的http://www.aarongoldenthal.com/post/2009/03/15/ASPNET-Databinding-Bind()-Method-Dissected.aspx.

The short answer is that when a Bind statement is compiled, there are some limitations on extracting values for an insert/update. If the controls within the FormView are then within another Naming Container (TabContainer and TabPanel are both naming containers), then the compiler can't resolve how to extract the value from the TextBox. I have a more detailed discussion of this on my blog at http://www.aarongoldenthal.com/post/2009/03/15/ASPNET-Databinding-Bind()-Method-Dissected.aspx.

要解决这个问题,你需要手动提取值,是这样的:

To get around this, you'll need to extract the values manually, something like:

保护无效FormView1_ItemUpdating(对象发件人,FormViewUpdateEventArgs E) {     //获取引用的控件     文本框LastNameTextBox = FormView1.FindControl(TabContainer1)的FindControl(TabPanel1)的FindControl(LastNameTextBox)的文本框;

protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e) { // Get references to the controls TextBox LastNameTextBox= FormView1.FindControl("TabContainer1").FindControl("TabPanel1").FindControl("LastNameTextBox") as TextBox;

// Set update parameters in datasource
ObjectDataSource1.UpdateParameters["LastName"].DefaultValue = LastNameTextBox.Text;

}

由于的FindControl只搜索当前的命名容器,你需要通过挖掘每个命名容器(FormView控件,TabContainer的,和一个tabpanel)才能到文本框。

Since FindControl only searches the current naming container, you'll need to dig through each naming container (FormView, TabContainer, and TabPanel) to get to the TextBox.

希望有所帮助。

亚伦

块引用

这篇关于AJAX TabContainer的FormView控件内不插入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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