locked
Unable to get textbix data from a user custom control over to a another page using server.trasnfer RRS feed

  • Question

  • User2055419555 posted

     Guys, it's been two days of reading and searching and I'm honestly pulling my hair off after no solution has been found.

     I have a MasterPage and a Custom User Control inside of Controls/SearchWebUserControl.ascx with 2 text boxes .

    When this text boxes a filled with data,  I have an onClick event that does a Server.Transfer to Trasnfer.aspx page. On my transfer.aspx page I have the following code:

     

                SearchWebUserControl SearchControl = (SearchWebUserControl)FindControl("EslomioSearchControl");
                if (SearchControl != null) {
                    TextBox SearchTextBox = (TextBox)SearchControl.FindControl("SearchTextBox");
                    if (SearchTextBox != null) {
                        resultsLabel.Text = SearchTextBox.Text;
                    }
                } else {
                    resultsLabel.Text = "Cannot find Search TextBox in the Search control.";
                }

     

    Guys, I would appreciate  if you can help me find  a way to get the data on the other page.

     

    Thanks

     

    Beldwin Cabrera
     

    Monday, September 1, 2008 1:32 PM

Answers

  • User863160722 posted
    Try something like this: 
    Page page = this.Page.PreviousPage ?? this.Page;
    SearchWebUserControl SearchControl = (SearchWebUserControl)page.FindControl("EslomioSearchControl");
    ...
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 2, 2008 2:01 PM