我如何通过使用查询字符串写下面的代码........... [英] How can i write below code by using Query String...........

查看:66
本文介绍了我如何通过使用查询字符串写下面的代码...........的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用查询字符串编写以下代码...........



Forrm1 ....

How can i write below code by using Query String...........



Forrm1....

Application["DEMO_APPLICATION"] = txtname.Text;
      Application["DEMO_APPLICATION1"] = txtpwd.Text;
      Application["DEMO_APPLICATION2"] = txtpassword.Text;
      Application["DEMO_APPLICATION3"] = txtadd.Text;
      Application["DEMO_APPLICATION4"] = txtfull.Text;
      Application["DEMO_APPLICATION5"] = DropDownList1.SelectedIndex;
       Response.Redirect("default3.aspx");



form2 ....



form2....

TextBox1.Text = Application["DEMO_APPLICATION"].ToString();
        TextBox2.Text = Application["DEMO_APPLICATION1"].ToString();
        TextBox3.Text = Application["DEMO_APPLICATION2"].ToString();
        TextBox4.Text = Application["DEMO_APPLICATION3"].ToString();
        TextBox5.Text = Application["DEMO_APPLICATION4"].ToString();
        TextBox6.Text = Application["DEMO_APPLICATION5"].ToString();

推荐答案

亲爱的朋友,

在这里,您可以使用ArrayList类,以便将不同应用程序级别变量的值存储在不同的索引中,然后将数组对象传递到查询字符串中,然后将值分配给form2中的文本框.
Dear Friend,

Here you can use ArrayList class in order to store the values of different application level variable at different indexes and then passing the array object in query string and then assigning the values to the text boxes in form2.


In form one
Response.Redirect("default3.aspx?DEMO_APPLICATION="+txtname.Text+"&    DEMO_APPLICATION1=" +txtpwd.Text+"&DEMO_APPLICATION2="+txtpassword.Text+"&DEMO_APPLICATION3="+ txtadd.Text+"&DEMO_APPLICATION4="+ txtfull.Text+"&DEMO_APPLICATION5="+ DropDownList1.SelectedIndex);

And in form2 you need to access the query string

like 

string demoApplicationName=Convert.Tostring( Page.Request.Param["DEMO_APPLICATION1"])
same for other variable DEMO_APPLICATION2



将demoApplicationName替换为要将数据设置到的文本框.



Replace demoApplicationName with the textbox you want to set the data into.


这篇关于我如何通过使用查询字符串写下面的代码...........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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