| |

VerySource

 Forgot password?
 Register
Search
View: 3225|Reply: 26

Ask about the user control to pass values ​​to the aspx page

[Copy link]

1

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-6 17:00:01
| Show all posts |Read mode
There is a user control for product search function on the right of index.aspx on the homepage of the website. Right.ascx has Dropdownlist1 and TextBox1. I want to perform a point search to display the search results on the product page. Server.Transfer ("products.aspx")

Ask each hero, how should it be achieved? Get is also set, but I don't know how to get the value in the user control in the product page. Please help me. Thank you !!!!!
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 China

Post time: 2020-1-6 23:36:01
| Show all posts
Try Redirect ()
Reply

Use magic Report

0

Threads

8

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-6 23:39:01
| Show all posts
Can be encapsulated into attributes and read directly
Save in session value
Passing values ​​by URL
Reply

Use magic Report

0

Threads

60

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-1-7 10:03:01
| Show all posts
It is best to customize a property for the user control to reduce the coupling
Reply

Use magic Report

1

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-8 23:36:02
| Show all posts
I don't want to pass the value in the address bar.
Can3521565tell me how to achieve it?
Reply

Use magic Report

0

Threads

73

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-9 08:18:02
| Show all posts
public string txt1
  {
   get
   {
    return TextBox1.Text;
   }
  }

Reference: http://blog.csdn.net/zhouji700/archive/2006/09/19/1245774.aspx
Reply

Use magic Report

1

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-9 09:36:01
| Show all posts
zhouji700This is how I do it. It can be used in aspx and aspx pages, but it is not possible to pass ascx value to aspx.
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-1-9 11:09:01
| Show all posts
In ascx

public string SelectedValue
{
 get
{
 return this.DropDownList1.SelectedValue;
}
}

public string TextValue
{
 get
{
   return this.TextBox1.Text;
}
}

Direct access in aspx is ok
Reply

Use magic Report

1

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-9 15:27:01
| Show all posts
shenmue024I defined it in ascx, but I can't receive the value

Objects of type "ASP.cn_about_aspx" cannot be cast to type "cn_right".

If you use the method of static variables. Depressed ...
Reply

Use magic Report

1

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-1-9 15:54:01
| Show all posts
If aspx is to aspx, the method of the brother upstairs is feasible, but ascx is not.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list