Ajax Tab容器问题 [英] Ajax Tab Container issue

查看:63
本文介绍了Ajax Tab容器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我正在使用ajax控件工具包tabcontainer,里面有5个选项卡面板。每个选项卡包含必须输入信息的区域。该页面还包含添加,编辑和删除按钮,其上方有网格视图。


我要做的是让用户在更改activetab时保存或取消更改。我正在使用javascript确认框,但我需要尝试检索从javascript框中按下的值的值,以决定是放弃更改还是留在页面上并让用户完成输入。有什么方法可以将javascript框中的值保存到变量中,或者我必须尝试别的吗?


如果您需要任何进一步的解释,我将非常乐意回复。


PS我不确定是否要在javascript部分或asp.net部分发布此内容,因为即时通讯使用带有c#的asp.net。


这有点像我正在使用但想把它变成一个确认框并提取真值或假值。

展开 | 选择 | 换行 | 行号

解决方案

我们用JavaScript 确认而不是JavaScript提醒:)


是的我确实使用了javascript确认,但没有使用该代码。我改变它确认,但我试图将确认值保存到asp中的变量。如果用户选择确定以保存工作...我想将更改保存到数据库。如果他们选择取消我想放弃更改并允许他们移动到另一个选项卡。我的主要问题是我无法捕获javascript确认符的值。


这是我的html页面中的javascript函数:

展开 | 选择 | Wrap | 行号


使用HiddenField存储用户选择的值。

可以在JavaScript和C#代码中访问HiddenFields(使用ASP.NET HiddenField让生活变得更轻松。


向页面添加一个ASP.NET HiddenField,并为其提供一个类似userSelectedYes的ID (或者对你有意义的东西)。


然后修改你的JavaScript来检索这个元素,并在用户点击是或否时设置值。然后当页面提交用户时,可以在userSelectedYes.Value中访问。


JS:

展开 | 选择 | Wrap | 行号

Ok so I am using the ajax control toolkit tabcontainer with 5 tab panels inside of it. Each tab contains areas where one must input information. The page also contains add, edit, and delete buttons with gridviews above them.

What I am trying to do is to make the user save or cancel changes when they change the activetab. I am using a javascript confirm box but I need to try to retrieve the value of what is pressed from the javascript box to decide whether to discard the changes or stay on the page and make the user finish the input. Is there any way to save the value from the javascript box into a variable so or must i try something else?

If you need any further explanation i will be more than glad to respond.

PS I wasnt sure whether to post this in the javascript section or the asp.net section since im using asp.net with c#.

This is kinda what im using but would like to turn it into a confirm box and pull the true or false value.

Expand|Select|Wrap|Line Numbers

解决方案

Use a JavaScript confirm instead of a JavaScript alert :)


yes i do use a javascript confirm but not in that code. i change it a confirm but im trying to save the confirm value to a variable in asp. If the user selects ok to save the work...i want to save the changes to the database. if they select cancel i want to discard the changes and allow them to move to another tab. my main problem is that i cant capture the value of the javascript confirmbox.

this is the javascript function in my html page:

Expand|Select|Wrap|Line Numbers


Use a HiddenField to store the value that the user selected.
HiddenFields are accessible in JavaScript and in your C# code (use an ASP.NET HiddenField to make life easier).

Add an ASP.NET HiddenField to the page and give it an ID like "userSelectedYes" (or something that makes sense to you).

Then modify your JavaScript to retrieve this element and set the value when the user clicks yes or no. Then when the page submits the user''s choice will be accessible in the userSelectedYes.Value.

JS:

Expand|Select|Wrap|Line Numbers


这篇关于Ajax Tab容器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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