Hi Friends,
Am facing a problem in Modal popup. following is the source code

<div>
        <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" Style="display: none" />
        <ajaxToolkit:ModalPopupExtender runat="server" ID="programmaticModalPopup" BehaviorID="programmaticModalPopupBehavior"
            TargetControlID="hiddenTargetControlForModalPopup" PopupControlID="programmaticPopup"
            BackgroundCssClass="modalBackground" DropShadow="True" PopupDragHandleControlID="programmaticPopupDragHandle"
            RepositionMode="RepositionOnWindowScroll">
        </ajaxToolkit:ModalPopupExtender>
        <asp:Panel runat="server" CssClass="modalPopup" ID="programmaticPopup" ScrollBars="auto"
            Height="300px" Style="display: none; width: 600px; padding: 10px">
       
            <div style="padding-top: 10px;">
              <asp:TextBox ID="TextBoxEdit" runat="server"></asp:TextBox>            </div>
            <div>
                <a runat="server" id="EditQuestion" class="button" href="#" onserverclick="EditQuestion_Click">
                    Update</a> <a id="hideModalPopupViaClientButton" class="button" href="#">Cancel</a>
            </div>
            <br />
        </asp:Panel>
    </div>

From below code am triggering the popup and also setting the intial value of TextBoxEdit .

protected void LinkButtonQuestionEdit_Click(object sender, EventArgs e)
        {
            LinkButton questionLink = (LinkButton)sender;
            QuestionBank question = business.GetQuestionById(int.Parse(questionLink.CommandArgument));
            TextBoxEdit.Text = question.Question;
                this.programmaticModalPopup.Show();
        }

from below code code am capturing the TextBoxEdit value but the value getting null.

protected void EditQuestion_Click(object sender, EventArgs e)
        {
            QuestionBank question = new QuestionBank();
            question.Question = TextBoxEdit.Text;
          business.UpdateQuestion(question);
            BindQuestionBankGrid();
            this.programmaticModalPopup.Hide();
        }

you can find the controls in modalpopup . am getting popup and am changing the value of TextBoxEdit. but in code behind TextBoxEdit is getting null After postback.
Even if we wont change then also the TextBoxEdit value will gets null value.

Please help me.

why ajax Modal Popup. use jquery Modal popup
easy 2 use

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.