AJAX.Net [英] AJAX.Net

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

问题描述




我现在一直在玩弄这一天。还有其他人试过吗?


两个问题:

1:如何将参数传递给服务器端事件,例如:如果你想

将选定的值从下拉列表传递到服务器端事件?我不能

看到一种方法。我最终只是将一个大数据集返回到

客户端javascript并在那里过滤它。我宁愿将一个变量传递给服务器端代码

,只返回我需要的记录。


2:我使用过AJAX.Net根据用户从另一个下拉列表中选择的内容动态填充一个下拉列表,而不是基于用户从另一个下拉列表中选择的内容,非常好地工作,但是当我做回发之后,将值添加到

下拉列表不是可见的到服务器端代码。这对于客户端进行的更改是有道理的。

我该如何解决这个问题? ASP.Net 2.0中的

客户端回拨功能是否使这更容易?


谢谢

N

Hi,

I have been toying around with this for a day now. Has anyone else tried it?

Two questions:
1: How do you pass a paramater to the server side event, e.g. if you wanted
to pass a selected value from a dropdownlist to the server side event? I cant
see a way of doing it. I have ended up just returning a big dataset to the
client javascript and filtering it there. I''d rather pass in a variable to
the server side code and only return the records I need.

2: I have used AJAX.Net to dynamically populate a dropdownlist without
postback based on what the user selects from another dropdownlist, works very
well, but when I do a postback afterwards the values added to the
dropdownlist are not "visible" to the server side code. This makes sense as
the changes were made on the client. How can I work around this? And does the
Client CallBack feature in ASP.Net 2.0 make this easier?

Thanks
N

推荐答案

AJAX.NET很有趣。有很多方法可以给猫皮肤。 Jason Diamond

已将自己的版本推广到免配置版本:

http://jason.diamond.name/weblog/200...ot-net-library


但你必须意识到这是一个带外回调。服务器页面

生命周期并没有在这里执行,因此在正常页面回发过程中你可以做出很多假设

。它只是一个RPC调用。


-Brock

DevelopMentor
http://staff.develop.com/ballen
AJAX.NET is interesting. There are lots of ways to skin a cat. Jason Diamond
has rolled his own into a configuration-free version:

http://jason.diamond.name/weblog/200...ot-net-library

But you''ve got to realize this is an out of band callback. The server page
lifecycle isn''t geting executed here, so lots of assumptions you could make
during a normal page postback don''t hold. It''s simply a RPC call.

-Brock
DevelopMentor
http://staff.develop.com/ballen

我现在一直在玩弄这一天。还有其他人试过吗?

两个问题:
1:如何将参数传递给服务器端事件,例如:如果您希望
将下拉列表中的选定值传递给服务器端事件?
我无法看到这样做的方法。我最终只是将一个大数据集返回到
客户端javascript并在那里过滤它。我宁愿将
变量传递给服务器端代码,只返回我需要的记录。
2:我使用AJAX.Net动态填充下拉列表而不用非常有效,但是当我之后进行回发时,添加到下拉列表中的值不是可见的。到服务器端代码。随着客户端的更改,这是有意义的。我怎么能在这周围工作呢? ASP.Net 2.0中的Client CallBack功能是否使这更容易?

N
Hi,

I have been toying around with this for a day now. Has anyone else
tried it?

Two questions:
1: How do you pass a paramater to the server side event, e.g. if you
wanted
to pass a selected value from a dropdownlist to the server side event?
I cant
see a way of doing it. I have ended up just returning a big dataset to
the
client javascript and filtering it there. I''d rather pass in a
variable to
the server side code and only return the records I need.
2: I have used AJAX.Net to dynamically populate a dropdownlist without
postback based on what the user selects from another dropdownlist,
works very well, but when I do a postback afterwards the values added
to the dropdownlist are not "visible" to the server side code. This
makes sense as the changes were made on the client. How can I work
around this? And does the Client CallBack feature in ASP.Net 2.0 make
this easier?

Thanks
N






你知道ASP.Net 2.0中的Client CallBack是否会更好吗?


" Brock Allen"写道:
Do you know if Client CallBack in ASP.Net 2.0 is going to be better?

"Brock Allen" wrote:
AJAX.NET很有趣。有很多方法可以给猫皮肤。 Jason Diamond
已将自己的版本推广到免配置版本:

http://jason.diamond.name/weblog/200...ot-net-library
生命周期并没有在这里执行,因此在正常页面回发过程中你可以做出很多假设。这只是一个RPC调用。

-Brock
DevelopMentor
http://staff.develop.com/ballen
AJAX.NET is interesting. There are lots of ways to skin a cat. Jason Diamond
has rolled his own into a configuration-free version:

http://jason.diamond.name/weblog/200...ot-net-library

But you''ve got to realize this is an out of band callback. The server page
lifecycle isn''t geting executed here, so lots of assumptions you could make
during a normal page postback don''t hold. It''s simply a RPC call.

-Brock
DevelopMentor
http://staff.develop.com/ballen


我一直在玩这个现在一天。还有其他人试过吗?

两个问题:
1:如何将参数传递给服务器端事件,例如:如果您希望
将下拉列表中的选定值传递给服务器端事件?
我无法看到这样做的方法。我最终只是将一个大数据集返回到
客户端javascript并在那里过滤它。我宁愿将
变量传递给服务器端代码,只返回我需要的记录。
2:我使用AJAX.Net动态填充下拉列表而不用非常有效,但是当我之后进行回发时,添加到下拉列表中的值不是可见的。到服务器端代码。随着客户端的更改,这是有意义的。我怎么能在这周围工作呢? ASP.Net 2.0中的Client CallBack功能是否使这更容易?

N
Hi,

I have been toying around with this for a day now. Has anyone else
tried it?

Two questions:
1: How do you pass a paramater to the server side event, e.g. if you
wanted
to pass a selected value from a dropdownlist to the server side event?
I cant
see a way of doing it. I have ended up just returning a big dataset to
the
client javascript and filtering it there. I''d rather pass in a
variable to
the server side code and only return the records I need.
2: I have used AJAX.Net to dynamically populate a dropdownlist without
postback based on what the user selects from another dropdownlist,
works very well, but when I do a postback afterwards the values added
to the dropdownlist are not "visible" to the server side code. This
makes sense as the changes were made on the client. How can I work
around this? And does the Client CallBack feature in ASP.Net 2.0 make
this easier?

Thanks
N




1)要从下拉列表中传递选定的值,请使用以下


DropDownList:


< select id =" dd1" name =" dd1">< / select>


获取所选值的Javascript

document.getElementById(''dd1 '')。value


如果您使用的是ASP:DropDownLIst,只需右键单击并查看源代码

从< SELECT>获取正确的ID ;创建的html控件。

我知道当你使用控件时,它会将名称更改为

[TAGNAME] _ [CONTROLID],或者类似的东西。


2)如果你想从Code Behind调用选择值,你必须声明它,然后将它设置为runat = server。所以


in html


< select runat =" server" ID = QUOT; DD1" name =" dd1">< / select>


代码背后


System.Web.UI.HtmlControls.HtmlSelect dd1


然后你可以在CodeBehind中获得它的价值。


现在,如果你从ClientSide脚本填充这个下拉列表,它可能会非常好。

所以请检查不是这样的。


希望这有帮助。

XmlHttp ROCK(或者现在创造的AJAX)


这里的文章告诉我这个:
http://msdn.microsoft .com / asp.net / de ... outrefresh.asp


我不知道.NET 2.0,试着自己玩这个当前


" NH" < NH@discussions.microsoft.com>在留言中写道

news:33 ********************************** @ microsof t.com ...
1) To pass the selected value from a dropdownlist, use the following

DropDownList:

<select id="dd1" name="dd1"></select>

Javascript to get the selected value

document.getElementById(''dd1'').value

If you are using an ASp:DropDownLIst, just right click and view source to
get the correct ID from the <SELECT> html control that is created.
I know when you using a control, it changes the name to be
[TAGNAME]_[CONTROLID], or something like that.

2) If you want to call the selects value from the Code Behind you have to
declare it, and set it to runat=server. so

in html

<select runat="server" id="dd1" name="dd1"></select>

in code behind

System.Web.UI.HtmlControls.HtmlSelect dd1

You can then get its value in the CodeBehind.

Now if you are populating this dropdown from the ClientSide script, it may
very well be empty when you post back.
So just check thats not the case.

Hope this helps.
XmlHttp ROCK (or AJAX as its now coined)

Here''s the article that taught me this:
http://msdn.microsoft.com/asp.net/de...outrefresh.asp

Don''t know about .NET 2.0, trying to play with that myself currently

"NH" <NH@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com...


我现在已经玩了一天了。还有其他人试过吗?

两个问题:
1:如何将参数传递给服务器端事件,例如:如果您希望
将选定的值从下拉列表传递到服务器端事件?我不能看到这样做的方法。我最终只是将一个大数据集返回到
客户端javascript并在那里过滤它。我宁愿将变量传递给服务器端代码,只返回我需要的记录。

2:我使用AJAX.Net动态填充下拉列表而不用下拉列表中的值不是可见的。到服务器端代码。这是有道理的
,因为这些变化是在客户端上进行的。我该如何解决这个问题?并且ASP.Net 2.0中的客户端回拨功能是否使这更容易?

N / /
Hi,

I have been toying around with this for a day now. Has anyone else tried
it?

Two questions:
1: How do you pass a paramater to the server side event, e.g. if you
wanted
to pass a selected value from a dropdownlist to the server side event? I
cant
see a way of doing it. I have ended up just returning a big dataset to the
client javascript and filtering it there. I''d rather pass in a variable to
the server side code and only return the records I need.

2: I have used AJAX.Net to dynamically populate a dropdownlist without
postback based on what the user selects from another dropdownlist, works
very
well, but when I do a postback afterwards the values added to the
dropdownlist are not "visible" to the server side code. This makes sense
as
the changes were made on the client. How can I work around this? And does
the
Client CallBack feature in ASP.Net 2.0 make this easier?

Thanks
N



这篇关于AJAX.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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