需要帮助 - Datalist linkbutton [英] Help Needed -- Datalist linkbutton

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

问题描述

嗨伙计,

假设我在页面上有两个链接按钮(比如lnkBtn1和

lnkBtn2)。在lnkbtn1的click事件中,我必须添加一个动态

创建的控件。在lnkBtn2的click事件中,我必须添加一个

datalist控件。

使用这个datalist控件我应该可以添加编辑,修改

并取消此控件中列出的项目。


这就是我设计的方式。我使用占位符动态添加控件

到按钮点击事件的页面。在我点击datalist控件的编辑按钮之前,一切似乎都很好。

工作正常。这个

控件消失了,并且没有引发相应的事件处理程序。


任何人都可以帮助改变我的设计以满足我的需求。


谢谢

Bharat

解决方案

Bharat,

如果我正确理解,你处在一个棘手的境地......但是它的价值很清楚地理解和学习。


基本上是发生了什么(或者而不是发生的事情是,当点击编辑按钮时,你需要

来_reload_控件。你有什么是

这个:


链接按钮1点击 - >

加载控制1 - >

编辑点击 - >

没什么


你需要的是:


链接按钮1单击 - >

控制1已加载 - >

编辑单击 - >

控制1已加载 - >

Woohoooo


最简单的方法之一是保持控件的名称

in viewstate对象。这将让你知道在点击编辑按钮时要重新加载哪个控件:


单击链接按钮1 - >

控件1已加载 - >

存储在viewstate中的控件名称/路径 - >

编辑点击 - >

从视图状态检索的控件名称/路径 - >

控件1已加载 - >

Woohoooo


希望有帮助。


Karl


" Bharat" < ****了Bh @ discussions.microsoft.com>在消息中写道

新闻:4E ********************************** @ microsof t.com ...

嗨伙计,
假设我在页面上有两个链接按钮(比如lnkBtn1和
lnkBtn2)。在lnkbtn1的click事件中,我必须添加一个动态创建的控件。在lnkBtn2的click事件中,我必须添加一个
datalist控件。
使用这个datalist控件我应该能够添加编辑,修改
并取消此控件中列出的项目。

这就是我设计的方式。我使用占位符在按钮的单击事件上动态添加控件到页面。在我点击datalist控件的编辑按钮之前,一切似乎都工作正常。
此控件消失,并且不会引发相应的事件处理程序。

任何人都可以帮助如何更改我的设计以满足我的需求。

谢谢
Bharat



Karl,

我以为我想出来但是现在我面对的是另一种类型的

问题。当我点击datalist的编辑时,

编辑控件中定义的控件显示为应该的。我更改了一些值,然后点击

update。永远不会提出更新事件。


什么可以造成这个问题。因为我动态加载这个数据列表,所以我每次往返服务器时都会将datalist加载到占位符




可能是什么问题。 />

谢谢

Bharat


" Karl"写道:

Bharat,
如果我理解正确,你处在一个棘手的境地......但它的东西值得清楚地理解和学习。 />
基本上发生了什么(或者更确切地说发生了什么)是在点击编辑按钮时需要_reload_reload_控件。你有什么是
这个:

链接按钮1点击 - >
控制1加载 - >
编辑点击 - >
NOTHING

你需要的是这个:

链接按钮1点击 - >
控制1加载 - >
编辑点击 - - >
控件1已加载 - >
Woohoooo

实现此目的的最简单方法之一是在viewstate对象中保留控件的名称
。这将告诉您在单击编辑按钮时要重新加载哪个控件:

单击链接按钮1 - >
加载控件1 - >
存储在viewstate中的控件名称/路径 - >
编辑单击 - >
从viewstate检索的控件名称/路径 - >
控件1已加载 - >

希望有所帮助。

Karl

Bharat < ****了Bh @ discussions.microsoft.com>在消息中写道
新闻:4E ********************************** @ microsof t.com。 ..

嗨伙计,
假设我在页面上有两个链接按钮(比如lnkBtn1和
lnkBtn2)。在lnkbtn1的click事件中,我必须添加一个动态创建的控件。在lnkBtn2的click事件中,我必须添加一个
datalist控件。
使用这个datalist控件我应该能够添加编辑,修改
并取消此控件中列出的项目。

这就是我设计的方式。我使用占位符在按钮的单击事件上动态添加控件到页面。在点击datalist控件的编辑按钮之前,一切似乎都工作正常。


控件消失,并且不会引发相应的事件处理程序。

任何人都可以帮助我改变我的设计以满足我的需求。

感谢
Bharat



不是100%......你每次重新绑定数据列表吗?你应该只在我第一次想到的时候绑定

...


Karl


" Bharat" < ****了Bh @ discussions.microsoft.com>在消息中写道

news:60 ********************************** @ microsof t.com ...

Karl,
我以为我弄明白了,但现在我面临着另一种问题。当我点击数据列表的编辑时,
编辑控件中定义的控件将显示为应该的控件。我更改了一些值,然后
点击更新。永远不会提出更新事件。

什么可以造成这个问题。我将数据列表加载到占位符中每次往返服务器,因为我动态加载这个数据列表。

可能是什么问题。

谢谢<巴拉特

卡尔写道:

Bharat,
如果我理解正确,你处在一个棘手的境地......但它的东西值得清楚地理解和学习。 />
基本上发生了什么(或者更确切地说发生了什么)是你需要在单击编辑按钮时_reload_控件。你有什么
是这样的:

链接按钮1点击 - >
控制1加载 - >
编辑点击 - >
NOTHING

你需要的是这个:

链接按钮1点击 - >
控制1加载 - >
编辑点击 - - >
控件1已加载 - >
Woohoooo

实现此目的的最简单方法之一是在viewstate对象中保留
控件的名称。这将让您知道在单击编辑按钮时要重新加载$ ​​b $ b的控件:

单击链接按钮1 - >
控件1已加载 - >
存储在viewstate中的控件名称/路径 - >
编辑单击 - >
从viewstate检索的控件名称/路径 - >
控件1已加载 - >

希望有所帮助。

Karl

Bharat < ****了Bh @ discussions.microsoft.com>在消息中写道
新闻:4E ********************************** @ microsof t.com。 ..

嗨伙计,
假设我在页面上有两个链接按钮(比如lnkBtn1和
lnkBtn2)。在lnkbtn1的click事件中,我必须添加
动态创建的控件。在lnkBtn2的click事件中,我必须添加一个
datalist控件。
使用这个datalist控件我应该能够添加edit,
修改并取消此控件中列出的项目。

这就是我设计的方式。我使用占位符将控件
动态添加到按钮的单击事件页面上。在点击datalist控件的编辑按钮之前,一切似乎都工作正常。


控件消失,并且不会引发相应的事件处理程序。

任何人都可以帮助如何改变我的设计以满足我的需求。

感谢
Bharat




Hi Folks,
Suppose I have two link button on a page (say lnkBtn1 and
lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically
created control. And On the click event of the lnkBtn2 I have to add a
datalist control.
Using this datalist control I should be able to add edit, modify
and cancel the items listed in this control.

Here is how I designed. I used placeholder to add the controls dynamically
to the page on the click events of the buttons. Everything seems to be
working fine until I click on the edit button of the datalist control. This
control disappears and the corresponding event handler is not raised.

Can anyone help how to change my design to suit my needs.

Thanks
Bharat

解决方案

Bharat,
If I understand correctly, you are in a tricky situation....but its
something worth clearly understanding and learning.

Basically what''s happening (or rather what isn''t happening) is that you need
to _reload_ the controls when the edit button is clicked. What you have is
this:

Link Button 1 click -->
Control 1 loaded -->
Edit Clicked -->
NOTHING

What you need is this:

Link button 1 clicked -->
Control 1 loaded -->
Edit Clicked -->
Control 1 Loaded -->
Woohoooo

One of the easiest ways to achieve this is to keep the name of the control
in viewstate object. This will let you know which control to reload when
the edit button is clicked:

Link button 1 clicked -->
Control 1 loaded -->
Control name/path stored in viewstate -->
Edit Clicked -->
Control name/path retrieved from viewstate -->
Control 1 Loaded -->
Woohoooo

Hope that helps.

Karl

"Bharat" <Bh****@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...

Hi Folks,
Suppose I have two link button on a page (say lnkBtn1 and
lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically
created control. And On the click event of the lnkBtn2 I have to add a
datalist control.
Using this datalist control I should be able to add edit, modify
and cancel the items listed in this control.

Here is how I designed. I used placeholder to add the controls dynamically
to the page on the click events of the buttons. Everything seems to be
working fine until I click on the edit button of the datalist control. This control disappears and the corresponding event handler is not raised.

Can anyone help how to change my design to suit my needs.

Thanks
Bharat



Karl,
I thought I figured it out but now I am facing a different kind of
problem. When I click on edit of the datalist the controls defined in the
edit control show up as they should be. I change some values and then click
update. Update event is never raised.

What can casue this problem. I am loading the datalist into a placeholder
each each round trip to the server since I load this datalist dynamically.

What could be the problem.

Thanks
Bharat

"Karl" wrote:

Bharat,
If I understand correctly, you are in a tricky situation....but its
something worth clearly understanding and learning.

Basically what''s happening (or rather what isn''t happening) is that you need
to _reload_ the controls when the edit button is clicked. What you have is
this:

Link Button 1 click -->
Control 1 loaded -->
Edit Clicked -->
NOTHING

What you need is this:

Link button 1 clicked -->
Control 1 loaded -->
Edit Clicked -->
Control 1 Loaded -->
Woohoooo

One of the easiest ways to achieve this is to keep the name of the control
in viewstate object. This will let you know which control to reload when
the edit button is clicked:

Link button 1 clicked -->
Control 1 loaded -->
Control name/path stored in viewstate -->
Edit Clicked -->
Control name/path retrieved from viewstate -->
Control 1 Loaded -->
Woohoooo

Hope that helps.

Karl

"Bharat" <Bh****@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...

Hi Folks,
Suppose I have two link button on a page (say lnkBtn1 and
lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically
created control. And On the click event of the lnkBtn2 I have to add a
datalist control.
Using this datalist control I should be able to add edit, modify
and cancel the items listed in this control.

Here is how I designed. I used placeholder to add the controls dynamically
to the page on the click events of the buttons. Everything seems to be
working fine until I click on the edit button of the datalist control.


This

control disappears and the corresponding event handler is not raised.

Can anyone help how to change my design to suit my needs.

Thanks
Bharat




not 100%...are you rebinding the datalist each time? You should only bind
it the first time I think...

Karl

"Bharat" <Bh****@discussions.microsoft.com> wrote in message
news:60**********************************@microsof t.com...

Karl,
I thought I figured it out but now I am facing a different kind of
problem. When I click on edit of the datalist the controls defined in the
edit control show up as they should be. I change some values and then click update. Update event is never raised.

What can casue this problem. I am loading the datalist into a placeholder
each each round trip to the server since I load this datalist dynamically.

What could be the problem.

Thanks
Bharat

"Karl" wrote:

Bharat,
If I understand correctly, you are in a tricky situation....but its
something worth clearly understanding and learning.

Basically what''s happening (or rather what isn''t happening) is that you need to _reload_ the controls when the edit button is clicked. What you have is this:

Link Button 1 click -->
Control 1 loaded -->
Edit Clicked -->
NOTHING

What you need is this:

Link button 1 clicked -->
Control 1 loaded -->
Edit Clicked -->
Control 1 Loaded -->
Woohoooo

One of the easiest ways to achieve this is to keep the name of the control in viewstate object. This will let you know which control to reload when the edit button is clicked:

Link button 1 clicked -->
Control 1 loaded -->
Control name/path stored in viewstate -->
Edit Clicked -->
Control name/path retrieved from viewstate -->
Control 1 Loaded -->
Woohoooo

Hope that helps.

Karl

"Bharat" <Bh****@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...

Hi Folks,
Suppose I have two link button on a page (say lnkBtn1 and
lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I have to add a
datalist control.
Using this datalist control I should be able to add edit, modify and cancel the items listed in this control.

Here is how I designed. I used placeholder to add the controls dynamically to the page on the click events of the buttons. Everything seems to be
working fine until I click on the edit button of the datalist control.


This

control disappears and the corresponding event handler is not raised.

Can anyone help how to change my design to suit my needs.

Thanks
Bharat




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

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