禁用asp.net C#中的按钮 [英] disabling button in asp.net C#

查看:100
本文介绍了禁用asp.net C#中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个.aspx页面.第一页有两个按钮,第二页有两个按钮.

在第一页中,一个按钮控件已启用,而另一个按钮已禁用..当用户单击第一页的已启用按钮时,将显示第二页.在第二页上,用户单击一个按钮.首页的已禁用按钮.(即,在启用了两个按钮控件的情况下显示首页)

我正在使用asp.net,C#,Visual Studio 2005 ..

请帮我..

谢谢你.

问候

karan

I have 2 .aspx pages . and there are two buttons in first page and two buttons in second page.

In first page one button control is enabled and another is disabled.. when the user clicks on enabled button of first page second page will be displayed.. and on second page user clicks one button.. when this button is clicked i want enable the disabled button of first page..(i.e.,the first page is displayed with both the button controls enabled )

I am using asp.net , C#, visual studio 2005..

Plz help me..

thank u.

regards

karan

推荐答案

是什么阻止了您?听起来很简单.

您可以通过多种方式从第二个页面访问第一个页面,例如:
1.查询字符串(如果正在导航)
2. PreviousPage概念(如果不导航)

您所需要做的就是将标记从另一页面传递到一页.你有没有尝试过?
如果您遇到问题,请这样做并发布特定问题.
Whats stopping you? All sounds straight and simple.

You have various ways to access the 1st page from 2nd, for example:
1. Querystring (if navigating)
2. PreviousPage concept (if not navigating)

All you need is to pass on the flag to one page from other. Did you try at all?
Please do so and do post specific issue, if you face.


u可以将查询字符串从第二页传递到第一页

在第二页按钮上,单击u可以写
response.redirect(firstpage.aspx?id = 1);

那么在首页加载时,您就可以做到
if(Convert.Tostring(Request.Querystring ["id"])=="1")
button.Enabled = true;
u can pass querystring from second page to first page

on second page button click u can write
response.redirect(firstpage.aspx?id=1);

then on first page load u can do
if(Convert.Tostring(Request.Querystring["id"])=="1")
button.Enabled=true;


第二页

按钮单击事件
in second page

on button click event
    protected void Button1_Click(object sender, EventArgs e)
{
Response.Redrect("Ur firstpage.aspx?id=1");
}



在您的第一页page_load



in ur first page in page_load

if(convert.Tostring(Request.Querystring["id"]=="1"s)
{
button1.Enabled=True;
}
else
{
button1.Enabled=False;
}



试试吧



try it


这篇关于禁用asp.net C#中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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