链接数据网格编辑按钮 [英] link data grid edit button
本文介绍了链接数据网格编辑按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
在Visual Studio .NET 2003中,
关于datagrid对象:
怎么能我链接按钮元素:编辑,做一些客户端事件(例如
作为消息框,
并在此之后再向服务器做另一个事件(做一些操作)在数据库上
。
如果我不能 - 我怎么能以某种棘手的方式做到这一点?
谢谢:)
Hello,
In Visual studio .NET 2003,
On datagrid object :
How can I link the button element : edit, to do a some client events (such
as message box,
and do another event just after that to the server (do some manipulation on
the database).
If I cannot - how can I do that anyway in some tricky way ?
Thanks :)
推荐答案
编程没有限制:)))
创建一个名为MyControlLibrary的web控件库,代码如下......
并在任何地方使用此控件...随意在
上建立一些东西。 ...
使用System;
使用System.Web.UI;
使用System.Web.UI.WebControls;
命名空间MyControlLibrary
{
[System.ComponentModel.DefaultProperty(" Text"),
ToolboxData("< {0}:MyL inkButton runat = server>< / {0}:MyLinkButton>")]
公共类MyLinkButton:System.Web.UI.WebControls.LinkButton
{
string question ="?" ;;
[System.ComponentModel.Bindable(true)]
public String Question
{
get
{
返回问题;
}
set
{
question ="" ;;
}
}
protected override void Render(HtmlTextWriter输出)
{
Attributes.Add(" onClick",String.Format(" javascript:return
确认(''{0}'')",问题));
base.Render(输出);
}
}
}
-
谢谢,
Yunus Emre ALP?ZEN
BSc,MCAD.NET
" John M" < nobody@nospam_please.com>在消息中写道
news:OR ************** @ TK2MSFTNGP15.phx.gbl ...
There is no limit in programming:)))
Create a web control library named as MyControlLibrary and following code...
And use this control in anywhere... Feel free to built on something on
this....
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyControlLibrary
{
[System.ComponentModel.DefaultProperty("Text"),
ToolboxData("<{0}:MyLinkButton runat=server></{0}:MyLinkButton>")]
public class MyLinkButton : System.Web.UI.WebControls.LinkButton
{
string question="?";
[System.ComponentModel.Bindable(true)]
public String Question
{
get
{
return question;
}
set
{
question="";
}
}
protected override void Render(HtmlTextWriter output)
{
Attributes.Add("onClick",String.Format("javascript :return
confirm(''{0}'')",Question));
base.Render(output);
}
}
}
--
Thanks,
Yunus Emre ALP?ZEN
BSc, MCAD.NET
"John M" <nobody@nospam_please.com> wrote in message
news:OR**************@TK2MSFTNGP15.phx.gbl...
你好,>
在Visual Studio .NET 2003中,
关于datagrid对象:
如何链接按钮元素:编辑,做一些客户端事件(如
作为消息框,然后在服务器之后做另一个事件(在数据库上做一些操作)。
如果我不能 - 我怎么能无论如何以某种棘手的方式做到这一点?
谢谢:)
Hello,
In Visual studio .NET 2003,
On datagrid object :
How can I link the button element : edit, to do a some client events (such
as message box,
and do another event just after that to the server (do some manipulation
on
the database).
If I cannot - how can I do that anyway in some tricky way ?
Thanks :)
....我怎么能制作一个网络控制库(文件 - >新??? ...)
谢谢:)
" Yunus Emre ALP?ZEN [MCAD.NET]" <叶*** @ msakademik.net>在消息中写道
新闻:eB ************** @ TK2MSFTNGP09.phx.gbl ...
.... and how can I make a web-control library (file - > new ??? ... )
Thanks :)
"Yunus Emre ALP?ZEN [MCAD.NET]" <ye***@msakademik.net> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
没有限制编程::))
创建一个名为MyControlLibrary的web控件库,然后按照
代码...并在任何地方使用此控件...随意构建
的东西使用System;
使用System.Web.UI;
使用System.Web.UI.WebControls;
名称空间MyControlLibrary
{System.ComponentModel.DefaultProperty(" Text"),
ToolboxData("< {0}:MyLinkButton runat = server>< / {0}:MyLinkButton> ;")]
公共类MyLinkButton:System.Web.UI.WebControls.LinkButton
{
字符串问题="?" ;;
[System.ComponentModel.Bindable (true)]
公共字符串问题
{
获得
{
返回问题;
}
设置
{
question ="" ;;
}
}
受保护的覆盖无效渲染(HtmlTe) xtWriter输出)
{
Attributes.Add(" onClick",String.Format(" javascript:return
confirm(''{0}'')",Question)) ;
base.Render(输出);
}
}
}
-
谢谢,> Yunus Emre ALP?ZEN
BSc,MCAD.NET
John M < nobody@nospam_please.com>在消息中写道
新闻:或者************** @ TK2MSFTNGP15.phx.gbl ...
There is no limit in programming:)))
Create a web control library named as MyControlLibrary and following
code... And use this control in anywhere... Feel free to built on
something on this....
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyControlLibrary
{
[System.ComponentModel.DefaultProperty("Text"),
ToolboxData("<{0}:MyLinkButton runat=server></{0}:MyLinkButton>")]
public class MyLinkButton : System.Web.UI.WebControls.LinkButton
{
string question="?";
[System.ComponentModel.Bindable(true)]
public String Question
{
get
{
return question;
}
set
{
question="";
}
}
protected override void Render(HtmlTextWriter output)
{
Attributes.Add("onClick",String.Format("javascript :return
confirm(''{0}'')",Question));
base.Render(output);
}
}
}
--
Thanks,
Yunus Emre ALP?ZEN
BSc, MCAD.NET
"John M" <nobody@nospam_please.com> wrote in message
news:OR**************@TK2MSFTNGP15.phx.gbl...
你好,
>在Visual Studio .NET 2003中,
关于datagrid对象:
如何链接按钮元素:编辑,做一些客户事件
(例如
作为消息框,然后在服务器之后做另一个事件(在数据库上做一些操作)。
如果我不能 - 我怎么能无论如何以某种棘手的方式做到这一点?
谢谢:)
Hello,
In Visual studio .NET 2003,
On datagrid object :
How can I link the button element : edit, to do a some client events
(such
as message box,
and do another event just after that to the server (do some manipulation
on
the database).
If I cannot - how can I do that anyway in some tricky way ?
Thanks :)
嗨John,
你可以使用buttonObject.Attributes.Add方法添加client-
方javascript方法。以下代码片段显示了如何添加客户端消息框代码:
假设您有EditCommandColumn作为
$ b $的第一列b datagrid。在datagrid_ItemDataBound事件中:
if(e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton editBtn =(LinkButton)e.Item.Cells
[0] .Controls [0];
editBtn.Attributes.Add(" Onclick"," alert(''Edit
Message'');");
}
HTH
Elton Wang
el ********@hotmail.com
Hi John,
You can use buttonObject.Attributes.Add method add client-
side javascript method. Following code snippet shows how
to add client-side message box code:
Suppose you have EditCommandColumn as the first column of
the datagrid. In datagrid_ItemDataBound event:
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem )
{
LinkButton editBtn = (LinkButton)e.Item.Cells
[0].Controls[0];
editBtn.Attributes.Add("Onclick","alert(''Edit
Message'');");
}
HTH
Elton Wang
el********@hotmail.com
-----原帖-----
你好,
在Visual Studio .NET 2003中,
关于datagrid对象:
如何链接按钮元素:编辑,做一些
的客户端事件(例如消息框,
,然后在服务器之后再做一次事件(对数据库进行一些操作)。
如果我不能 - 我怎么能这样做呢?以某种棘手的
方式?
谢谢:)
。
-----Original Message-----
Hello,
In Visual studio .NET 2003,
On datagrid object :
How can I link the button element : edit, to do a some client events (suchas message box,
and do another event just after that to the server (do some manipulation onthe database).
If I cannot - how can I do that anyway in some tricky way ?
Thanks :)
.
这篇关于链接数据网格编辑按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文