如何使用C#编码隐藏按钮 [英] how to hide a button using c# coding

查看:188
本文介绍了如何使用C#编码隐藏按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以使用C#编码回答我的问题:


在网格中,当我单击更新"按钮时,它重定向到表单中,并在更新值后绑定到表单上的值.我要单击更新"按钮,即具有提交和更新按钮的表单.我要在页面重定向到表单时隐藏提交"按钮. ..

如何为此编写代码...

请任何人都可以帮助我...

Can anyone answer my question with c# coding:


In grid when i click update button it redirect into form and bind values on the form after updating the values i want to click update button the form having submit & update button..i want hide submit button when the page is redirect grid to form...

how can write coding for this...

please anyone can help me...

推荐答案


实际上我无法正确理解您的问题.
我要提出我所理解的建议.

//要禁用提交"按钮,请使用此按钮,但是它将可见并且您无法访问它
SubmitButton.Enabled = false;
//要隐藏该按钮,请使用此按钮.
SubmitButton1.Visible = false;


希望对您有帮助.))

actually i can''t understand ur question properly.
i am giving suggession upto what i understood.

//to disable the submit button use this but it will visible and u cannot able to access it
SubmitButton.Enabled = false;
//to hide the button from ur vission use this.
submitButton1.Visible = false;


hope it may help u..:)



根据您的代码.单击更新按钮后,您将转移到产品页面.
受保护的void GridView1_RowCommand(对象发送者,GridViewCommandEventArgs e)

因此您在查找点击的ID时遇到了问题,需要禁用该按钮.
为此,您可以使用

受保护的void GridView1_RowDataBound(对象发送者,GridViewRowEventArgs e)
{
//检查行类型
if(e.Row.RowType == DataControlRowType.DataRow)
{
//将数据项转换为相关对象
客户objCustomer =(Customer)e.row.dataitem;
//检查查询字符串id
if(objCustomer.id == int.parse(Session ["ID"].tostring()))
e.Row.FindControl ["btnUpdate"].Visible = false;
}


}

希望这会成功.

according to your code. you transfer to product page, when click on the update button.
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)

so you have a problem of finding the clicked id and need to disable the button.
for that you can use

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
// check the row type
if(e.Row.RowType == DataControlRowType.DataRow)
{
//Convert dataitem in to relavent object
Customer objCustomer =(Customer)e.row.dataitem;
//check with the query string id
if(objCustomer.id == int.parse( Session["ID"].tostring()))
e.Row.FindControl["btnUpdate"].Visible = false;
}


}

hope this will work.


这篇关于如何使用C#编码隐藏按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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