C#中的重定向错误 [英] redirecting error in C#

查看:93
本文介绍了C#中的重定向错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void Print_Data(object sender, EventArgs e)
   {
       string BK_Code = ((ImageButton)sender).CommandName;
       StringBuilder sb = new StringBuilder();
       sb.Append("<Script language='javascript'>");
       sb.Append("var m_Format = showModalDialog('Rpt_BL_Format.aspx','null','dialogHeight:150px,dialogWidth:150px,center:yes');");
       //StringBuilder sb1 = sb;
       //string ddl = sb.Append("m_Format").ToString();
       //sb.Append("if (m_Format == 'DL')");
      // sb.Append("window.open('Rpt_BL_DL.aspx?BK_Code=" + BK_Code + "&SMode=E','childwindow','fullscreen,status=yes, scrollbars=1,TOP=0,LEFT=0,resizable=YES');");
       sb.Append("if (m_Format == 'TTL')");
       sb.Append("window.open('Rpt_BL_BKN_TTL.aspx?BK_Code=" + BK_Code + "&SMode=E&m_Format=TTL','childwindow','fullscreen,status=yes, scrollbars=1,TOP=0,LEFT=0,resizable=YES');");
       sb.Append("</Script>");
       ClientScript.RegisterStartupScript(typeof(string), "Print", sb.ToString());
       sb.Append("if (m_Format == 'GBI')");
       sb.Append("window.open('Rpt_BL_BKN_GBI.aspx?BK_Code=" + BK_Code + "&SMode=E&m_Format=TTL','childwindow','fullscreen,status=yes, scrollbars=1,TOP=0,LEFT=0,resizable=YES');");
       sb.Append("</Script>");
       ClientScript.RegisterStartupScript(typeof(string), "Print", sb.ToString());
       sb.Append("if (m_Format == 'AIC')");
       sb.Append("window.open('Rpt_BL_BKN_AIC.aspx?BK_Code=" + BK_Code + "&SMode=E&m_Format=TTL','childwindow','fullscreen,status=yes, scrollbars=1,TOP=0,LEFT=0,resizable=YES');");
       sb.Append("</Script>");
       ClientScript.RegisterStartupScript(typeof(string), "Print", sb.ToString());
   }


上面的代码我曾用来重定向和打印页面.在这里,第一个当m_Format ==``TTL''时,这只能工作,其余的GBI和AIC不会重定向.此TTL,GBI和AIC是下拉列表值
为此发布解决方案
在此先感谢


the above code i have used to redirect and print the page. Here the first when m_Format == ''TTL'' this only working, remaining GBI and AIC are not redirecting. This TTL, GBI and AIC are dropdownlist value
post solution for this
Thanks in advance

推荐答案



在TTL代码之后,清除StringBuilder,然后再次附加所有以前的代码,然后对GBI和AIC进行操作.

或者,您可以创建三个单独的StringBuilder并执行它.

如果这种情况对您不起作用,请纠正我,

谢谢
-amit.
Hi,

After your TTL code clear your StringBuilder and then again append all previous code and do for GBI and AIC.

Or you can create three individual StringBuilder and execute it.

correct me if this scenario doen''t work for you,

Thanks
-amit.


这篇关于C#中的重定向错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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