在C#.NET中使用AJAX和动态创建的Web控件 [英] using AJAX with dynamically created web controls in C#.NET

查看:52
本文介绍了在C#.NET中使用AJAX和动态创建的Web控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我打算在AJAX论坛发帖,但显然有人

今天在那里发布了一个AJAX / C#问题被告知要试试这个

论坛。所以这里是:


我正在试图弄清楚AJAX是否可以在C#.NET中动态地使用
创建的控件。我已经能够非动态地创建
创建的控件来工作,但到目前为止,我的动态控件或链接到它们的
事件都不能与AJAX一起使用。有谁知道

或我是否可以这样做?动态创建的控件是在

占位符控件上创建的。我可以让代码在没有AJAX的情况下完美地工作,

但是现在我们希望每当用户在链接按钮或按钮上点击

时都不会有任何回发。 />

Tks

Hi all,

I was going to post this in the AJAX forum, but apparently someone
posted an AJAX/C# question in there today and was told to try this
forum instead. So here goes:

I''m trying to figure out whether AJAX will work with dynamically
created controls in C#.NET. I have been able to get non-dynamically
created controls to work, but so far none of my dynamic controls or
events linked to them are able to work with AJAX. Does anyone know how
or if I can do this? The dynamically created controls are created on a
placeholder control. I can get the code to work perfectly without AJAX,
but now we want there to not be any postbacks whenever the user clicks
on a linkbutton or a button.

Tks

推荐答案

Hello nat,


你对AJAX使用什么?你自己的实现还是第三部分?

一般来说,AJAX库有一个占位符,在你的组件中异步工作。


它不取决于是否你把它静态或恐怖地说出来

n>我打算在AJAX论坛发帖,但显然有人

n>今天在那里发布了一个AJAX / C#问题并被告知试试这个

n>论坛而不是。所以这里是:

n>

n>我正在试图弄清楚AJAX是否可以动态地工作

n>在C#.NET中创建控件。我已经能够非动态获得

n>创建了控件来工作,但到目前为止还没有我的动态控件或

n>链接到它们的事件能够与AJAX一起使用。有谁知道

n>怎么或如果我能做到这一点?创建动态创建的控件

n>在占位符控件上。我可以让代码完美运行

n>没有AJAX,但现在我们希望在没有任何回发时

n>用户点击链接按钮或按钮。

n>

n> Tks

n>

---

WBR,

Michael Nemtsev ::博客: http://spaces.msn.com/laflour


有时一个人仍然忠于一个事业,只因为它的对手不会因为b $ b不再是平淡的。 (c)Friedrich Nietzsche
Hello nat,

What do you use for AJAX? your own implementation or 3rd part one?
In general, AJAX libs have a placeholder, within your component works asynchronously.

It doesn''t depend whether you put it statically or dinamically
n> I was going to post this in the AJAX forum, but apparently someone
n> posted an AJAX/C# question in there today and was told to try this
n> forum instead. So here goes:
n>
n> I''m trying to figure out whether AJAX will work with dynamically
n> created controls in C#.NET. I have been able to get non-dynamically
n> created controls to work, but so far none of my dynamic controls or
n> events linked to them are able to work with AJAX. Does anyone know
n> how or if I can do this? The dynamically created controls are created
n> on a placeholder control. I can get the code to work perfectly
n> without AJAX, but now we want there to not be any postbacks whenever
n> the user clicks on a linkbutton or a button.
n>
n> Tks
n>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


我尝试过使用MagicAjax,以及简单的Ajax.dll。我试过

来使用ASP.NET Atlas,但它不适用于我们的VS.NET版本

(我们使用的是1.1和2003)。我甚至下载了一个

的控件应该可以让这个更简单,来自

AspxLab的Callback控件,但是这个特殊的控件不能用于免费

下载,我们买不起许可证只是为了看看这可能''b
的工作情况。关于我可以使用什么的任何想法?还有样品吗?例如,我的C#代码的一些

是:

public void SaveItemName(){

Label lblItemName = new Label( );

TextBox txtItemName = new TextBox();

Button btnSaveItem = new Button();

lblItemName.Text =" Item Name :" ;;

txtItemName.ID =" txtItemName";

btnSaveItem.Text =" Save Item";

btnSaveItem.Click + = new EventHandler(btnSaveItem_Click);

PlaceHolder1.Controls.Add(lblItemName);

PlaceHolder1.Controls.Add(txtItemName);

PlaceHolder1.Controls.Add(btnSaveItem);

}

I have tried using MagicAjax, as well as the simple Ajax.dll. I tried
to use ASP.NET Atlas, but it wouldn''t work with our version of VS.NET
(we''re using 1.1 and 2003). I even downloaded a control that was
supposed to be able to make this simpler, the Callback control from
AspxLab, but this particular control doesn''t work with the free
download, and we can''t afford a license just to see if this ''might''
work. Any ideas on what I could use? And a sample? For instance, some
of my C# code is:

public void SaveItemName(){
Label lblItemName = new Label();
TextBox txtItemName = new TextBox();
Button btnSaveItem = new Button();
lblItemName.Text = "Item Name: ";
txtItemName.ID = "txtItemName";
btnSaveItem.Text = "Save Item";
btnSaveItem.Click += new EventHandler(btnSaveItem_Click);
PlaceHolder1.Controls.Add(lblItemName);
PlaceHolder1.Controls.Add(txtItemName);
PlaceHolder1.Controls.Add(btnSaveItem);
}


你好,


我们的Callback控件在没有许可证的情况下完全正常运行。许可和未许可版本之间唯一的

差异是

未经许可的版本随机显示许可警告信息。


所以你应该能够尝试一下,看看它是否适合你,而无需购买许可证。如果您需要任何

帮助,请联系我们的支持人员(毕竟,如果没有,我们不会把它放在那里

下载有机会运行它以查看它是否有效

:P)。


示例包中包含演示项目的完整源代码,

在线版本可在以下网址找到:
http://www.aspxlab.com/AspxLabDemo/C...lbackDemo.aspx

您还可以在以下网址找到详细的文档:
http://www.aspxlab.com/doc/index.html


谢谢

AspxLab支持
http://www.aspxlab.com


nat写道:
Hi nat,

Our Callback control is fully functional without a license. The only
difference between the licensed and unlicensed version is that
unlicensed version randomly displays a license warning message.

So you should be able to try it out to see if it works for you without
purchasing a license. Please contact our support staff if you need any
help on how to use it (After all, we wouldn''t put it out there for
download if there is no chance for you to run it to see if it works
:P).

The sample package contains full source code of the demo project, an
online version of which can be found at:
http://www.aspxlab.com/AspxLabDemo/C...lbackDemo.aspx

You can also find detailed documentation at:
http://www.aspxlab.com/doc/index.html

Thanks
AspxLab Support
http://www.aspxlab.com

nat wrote:
我尝试过使用MagicAjax,以及简单的Ajax.dll。我尝试使用ASP.NET Atlas,但它不适用于我们的VS.NET版本(我们使用的是1.1和2003)。我甚至下载了一个可以使这个更简单的控件,来自AspxLab的回调控件,但是这个特殊的控件不能用于免费的
下载,而我们只是为了看看这可能会起作用,我们买不起牌照。关于我可以使用什么的任何想法?还有样品吗?例如,我的一些C#代码是:

public void SaveItemName(){
标签lblItemName = new Label();
TextBox txtItemName = new TextBox( );
按钮btnSaveItem = new Button();
lblItemName.Text =" Item Name:" ;;
txtItemName.ID =" txtItemName";
btnSaveItem.Text =" Save Item" ;;
btnSaveItem.Click + = new EventHandler(btnSaveItem_Click);
PlaceHolder1.Controls.Add(lblItemName);
PlaceHolder1.Controls.Add(txtItemName);
PlaceHolder1.Controls.Add(btnSaveItem);
}
I have tried using MagicAjax, as well as the simple Ajax.dll. I tried
to use ASP.NET Atlas, but it wouldn''t work with our version of VS.NET
(we''re using 1.1 and 2003). I even downloaded a control that was
supposed to be able to make this simpler, the Callback control from
AspxLab, but this particular control doesn''t work with the free
download, and we can''t afford a license just to see if this ''might''
work. Any ideas on what I could use? And a sample? For instance, some
of my C# code is:

public void SaveItemName(){
Label lblItemName = new Label();
TextBox txtItemName = new TextBox();
Button btnSaveItem = new Button();
lblItemName.Text = "Item Name: ";
txtItemName.ID = "txtItemName";
btnSaveItem.Text = "Save Item";
btnSaveItem.Click += new EventHandler(btnSaveItem_Click);
PlaceHolder1.Controls.Add(lblItemName);
PlaceHolder1.Controls.Add(txtItemName);
PlaceHolder1.Controls.Add(btnSaveItem);
}






这篇关于在C#.NET中使用AJAX和动态创建的Web控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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