George Onofrei

George Onofrei

  • NA
  • 89
  • 14.6k

Cross Page question

Jan 7 2011 1:17 PM
Basically, what I am trying to do is send information via PreviousPage somehow, but can't figure out how. Let me explai:

On One page (FirstPage.aspx) I have a DataList(Id = "DataList") which contains Labels(Id = "Label") ImageButtons (Id = "ImageButton"). Now when I press an ImageButton with PostbackUrl to second page, I need a way to get the Text from the label, but from the label from the selected item.
I've tried:

                        DataList idDataList = (DataList)(Page.PreviousPage.FindControl("DataList"));
                        Label idLabel = (Label)idDataList.SelectedItem.FindControl("Label");
                        string id = idLabel.Text;

but I get null on idDataList.

Also read that you can put an OnClick event on the ImageButton and the server executes both OnClick and PostBackUrl, but in vain. I mention that OnCLick event is on server. My next try is to put OnClick on client with javascript and will post back. Thanks in advance!!!

Answers (2)