Cross Page PostBack Using ListBox
Scenario:- You have a list box on a web page. You select value in the Listbox & Control is transferred to another page which shows value selected in the ListBox. Solution:- As there is no button on the page, ListBox AutoPostback should be true. But ListBox PostBacks to same Page. Here requirement is that it should post to other page. So we need to change the property of ListBox. We can not access Controls of Previous Page from Next Page. So we will define a Public property on First Page & access that on Second Page. Code Snippet:- Code on FirstPage.aspx.cs:- public partial class ListBoxCrossPagePostBack : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { PostBackOptions options = new PostBackOptions(ListBox1); options.ActionUrl = "SecondPage.aspx"; string s = Page.ClientScript.GetPostBackEventReference(options); ListBox1.Attributes["onchange"] = s; } public Lis...