detialsview控件中的自定义按钮功能 [英] custom button functionality in detialsview control
本文介绍了detialsview控件中的自定义按钮功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好先生.
我创建了一个详细信息视图控件.在detailsview中,我带了5个标签和5个文本框,在那个模板中,我放置了两个asp.net按钮. 1是保存"按钮2是取消"按钮.
现在,每当我单击保存"按钮时,我都希望将信息保存在数据库的文本框中.
那么如何为这些按钮赋予功能.
如果有人请帮助.
谢谢.
hello sir.
i created a details view control. in the detailsview i took 5 labels and 5 textboxes, in that i placed two asp.net buttons in the item templete. 1 is Save button 2 is Cancel button.
now when ever i click save button i want to save the information in the textboxes in the database.
so how do give the functionality to those buttons.
if anybody plz helpme.
thanking you.
推荐答案
<ItemTemplate>
<asp:Button ID="Button2" runat="server" CommandName="test" Text="Button" />
</ItemTemplate>
// Item command event
protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)
{
if (e.CommandName == "test")
{
// code to save to db.
}
}
这篇关于detialsview控件中的自定义按钮功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文