分配给文本框的字符串,但不会显示在浏览器中 [英] string assigned to textbox but not displays in browser

查看:80
本文介绍了分配给文本框的字符串,但不会显示在浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,当我通过值thr''response.redirect()然后在页面加载和分配的文本框上接收这些值时,值将显示在浏览器上,但通过服务器传递的值相同.分配给文本框,它在断点(调试)中显示值分配的文本框,但在浏览器中的文本框中不显示值
我的

sir,when i pass value thr'' response.redirect()then receive these values on pageload and assigned textbox then value displays on browser but same values passed thr'' server.transfer() value got on page load ,values assigned to textboxes it shows value assigned textbox in breakpoint(debugging) but not displays values in textboxeses in browser
my

//passing values on same page
protected void lnkedit_OnCommand(object sender, CommandEventArgs e)//passing values
{
  LinkButton objlbtn = (LinkButton)sender;
  string[] commandArgs = objlbtn.CommandArgument.ToString().Split(new char[] { ',' });
        int cid = Convert.ToInt32(commandArgs[0]);
        string cname = commandArgs[1];
        string csname=commandArgs[2];
Response.Redirect("AddUpdateCountry.aspx?cid=" + cid + "&cname=" + cname + "&csname=" + csname);//it works
Server.Transfer("AddUpdateCountry.aspx?cid=" + cid + "&cname=" + cname + "&csname=" + csname);//it not works 
}
//pageload function
protected void Page_Load(object sender, EventArgs e)
{
   if (!IsPostBack)           
   {
      BindGdvCountry();            
      if (Request.QueryString["cid"] != null)
      {
           int cid = Convert.ToInt32(Request.QueryString["cid"]);
           txtcountryname.Text =                                Convert.ToString(Request.QueryString["cname"]).Trim();
       txtshortname.Text = Convert.ToString(Request.QueryString["csname"]).Trim();//values comes from response.redirect are assigned to text box and show in browser but values comes from server.transfer are assigned to textbox but not shown in browser 
                btnSave.Text = "update";
            }
            
            
        }
    }


如果有解决方案,请通知我.
感谢和问候
dnyaneshwar


if there is any solution let me know.
thanks and regards
dnyaneshwar

推荐答案

您好.

Transfer方法是Response.Redirect的有效替代方法.重定向会强制Web服务器处理额外的请求,而Server.Transfer方法会将执行转移到服务器上的其他ASP页,并避免额外的往返行程.

希望这有助于解释.
Hi there.

The Transfer method is an efficient alternate for the Response.Redirect. A redirect forces the Web server to handle an extra request while the Server.Transfer method transfers execution to a different ASP page on the server, and avoids the extra round trip.

Hope this helps to explain.


这篇关于分配给文本框的字符串,但不会显示在浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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