无法重定向到asp.net中的另一个页面 [英] can't redirect to another page in asp.net

查看:121
本文介绍了无法重定向到asp.net中的另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,
我想基于empid ="+ empid +.重定向到EmployeeRegistration.aspx.
我使用此代码

sir,
i want to redirect to EmployeeRegistration.aspx based on the empid=" + empid +.
i use this code

Response.Redirect("../Hr/ Response.Redirect("../Hr/EmployeeRegistration.aspx?empid=" + empid + "", false);

,但它会生成错误页面.
如果有人知道答案,请帮助我...

,but its generates error page.
if anyone knows the answer please help me...

推荐答案

没有您的代码,我并没有清楚地知道问题.我想您正在尝试这样做:
试试这个:
I didn''t get the question clearly without your code.I guess you are trying to do this:
Try this:
 SqlDataReader dr;
 cmd = new SqlCommand("select * from tbl_ins where empid='"+empid+"'", con);
 dr = cmd.ExecuteReader();
 dr.Read();
 if (dr.HasRows)
 {
     int empid = Convert.ToInt32( dr[0].ToString());
     dr.close();
     if(empid==1)//just for an example
     {
     Response.Redirect("../Hr/EmployeeRegistration.aspx", false);
     }
     if(empid==2)// and so on
     {
      //other page
     }
 }
else
 {

 dr.Close();
 }


这篇关于无法重定向到asp.net中的另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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