保存和重置按钮的代码 [英] code for save and reset button

查看:98
本文介绍了保存和重置按钮的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


请指导如何在ASP.NET中编写C#代码以进行重置,保存按钮.

问候


Please guide writing the C# code for reset,save button in ASP.NET.

Regards

推荐答案

嗨桑迪普,

重置按钮
您必须生成按钮的onclick事件.并且在后面的代码中,您必须清除所有控件.

受保护的void Button_Click(对象发送者,EventArgs e)
{
TextBox1.Text =";
DropdownList1.SelectedIndex = 0;


}

如果要根据所使用的数据库将值保存在db中,则必须打开与该数据库的连接,然后编写查询以保存它.然后关闭连接.
hi sandeep,

for reset button
you have to generate onclick event of your button. and in code behind you have to clear all your controls.

protected void Button_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
DropdownList1.SelectedIndex=0;


}

and on savebutton depending on your functionallity you have to do it.if you want to save the values in db depending upon what db you are using you have to open connection to that then write a query to save it. and then close the connection.


这篇关于保存和重置按钮的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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