Ajax ModalPopup - Catch a button press

Hi
I have an Ajax ModalPopupExtender on a page.
To summarise ....
I have a link on a page, when I click the link the modal popup displays.
On this modalpopup I've a textbox and an 'ok' and 'cancel' button.

I wish to find out what was entered in the textbox when the button is clicked

I try the code attached but the value is null.

if (((TextBox)button1.Page.FindControl("theTitle")).Text == "")
               

Any ideas?
void okButton_Click(object sender, EventArgs e)
        {

            try
            {


                Button button1 = (Button)sender;

                //Dim ImageButton As imgBtn = CType(e.Item.FindControl("imgbtn_Zoom"), ImageButton);

                //TextBox theTitle = ((ImageButton)(e.Item.FindControl("theTitle")));


                if (((TextBox)button1.Page.FindControl("theTitle")).Text == "")
                {
                }
                else
                {
                }

                //Button button1 = (Button)sender;
                //((Label)button1.Page.FindControl("popupLabel")).Text = "Panel refreshed at " + DateTime.Now.ToString();



            }
            catch (Exception)
            {
                
                
            }


            



        }

Open in new window

hmcgeehanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

masterpassCommented:
just put

if (theTitle.Text == "")
// do rest
0
rajeeshmcaCommented:
HI hmcgeehan,

Is the Pop up shown is in the same aspx page where the clciked link is available or someother page...

If it is in the same page u can access the textBox Directly like
if(theTitle.Text == "")
{
}
0
hmcgeehanAuthor Commented:
If I do

if(theTitle.Text == "")
{
}

It does not compile

The name 'theTitle' does not exist in the current context

'theTitle' (the textbox) is on the ajax modalpopupextender

the modalpopupextender shows a textbox, an 'ok' button and a 'cancel' button.
When I click 'ok' then the event handler does fire

void okButton_Click(object sender, EventArgs e)

Thanks
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

masterpassCommented:
Is the modalpopup embedded in some kind of datalists ? like gridview, datalist, repeater ?

If it is so then you will have to use findcontrol with respect to the control used ...
0
rajeeshmcaCommented:
could u please post ur code
0
David RobitailleAnalyst ProgrammerCommented:
since you got
 Button button1 = (Button)sender;
 you could use

TextBox  theTitle = (TextBox) button1.Parent.FindControl("theTitle")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.