从代码隐藏修改 Jquery Tab
我想在后面的代码中修改jquery选项卡的文本标题,并且我还需要获取选定的选项卡编号。有什么想法吗?我试图用 HtmlGenericControl 引用该选项卡,但非常困难,因为它只是一个“div”并且不在服务器上运行。我正在使用 ASP.NET、C#。 非常感谢你们。
I Would like to modify the jquery tab's text header in the code behind, and I also need to get the selected tab number. Any ideas? I was trying to refer to the tab with HtmlGenericControl but is very difficult because it's just a "div" and doesn't run at server. I'm using ASP.NET, C#.
thanks very much guys.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
亚当感谢您的回答和您的时间。
我找到了解决我的问题的方法。为了能够从后面的代码更改每个选项卡中的标题文本。我决定在选项卡标题中使用标签。像这样:
使用在服务器端运行的标签很容易更改标题文本。
现在,对于下一个问题:“如何在后面的代码中获取选项卡索引”,我在我阅读的 100 页之间找到了一段代码,这非常有帮助。我们需要一个隐藏字段来实现它:
此代码还在回发后将焦点设置在正确的选项卡中。后面代码中具有tabindex的变量调用currentTabIndex.Value。
也许这不是解决这个问题的正确形式,但这是我发现的唯一形式。我希望有人也觉得它有用。
Adam thanks for your answer and your time.
I found a solution for my problems. In order to be able to change the header text in every tab, from code behind. I decided to use Labels in the tab's header. like this:
with label runing at server side is simple to change the header text.
Now, for the next problem: "how to get the tab index in the code behind", I found a piece of code between the 100 pages that I read, that was very helpfull. we need an hiddenfield in order to implement it:
this code also set the focus in the correct tab after postback. The variable who has the tabindex in the code behind calls currentTabIndex.Value.
Maybe this is not the right form to solve this problem but was the only one that I've found. I hope that somebody find it usefull too.
你说“jQuery”,然后在同一句话中说“代码隐藏”。您需要了解,这些是完全不同的技术,彼此之间根本不应该有直接的了解。
“代码隐藏”在服务器上运行,JavaScript 在客户端浏览器上运行。如果您想修改客户端页面上的活动选项卡,那就是 JavaScript。如果您想通知服务器此选项卡选择更改,则需要通过从 JavaScript 到您在服务器上创建的 Web 服务的 AJAX 调用来实现。
简而言之,仅使用(邪恶的).NET 控件无法完成此操作。
You say "jQuery" and then you say "code behind" in the same sentence. You need to understand that these are completely different technologies that should have no direct knowledge of each other at all.
"Code behind" runs on the server, JavaScript runs on the client's browser. If you want to modify the active tab on the client's page, that's JavaScript. If you want to then notify your server of this tab selection change, that needs to be achieved through an AJAX call from your JavaScript to a web service that you create on your server.
Simply put, this cannot be done with your (evil) .NET controls alone.