locked
[Q] How to Update User Control Data inside modal popup without closing the popup ? RRS feed

  • Question

  • User-308948172 posted

    Hi can anyone tell me how can i search and Update my User control using textChenged event on a Modal popup without closing the Popup ?

    I have this Dynamic User control that containts TextBox and GridView

    The Master page ImageButton supplies the GridView Datasource and the shows the User Control which displays the data

    Protected Sub imgBtn2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgBtn2.Click
    	Dim MyController As Control = LoadControl("~/UserControl/MyUserControl.ascx")
    
    	Dim gv As New GridView
    	gv = CType(UCBranch.FindControl("gvBranch"), GridView)
    	gv.DataSource = MyDatatable
    	gv.DataBind()
    	LoadUserContrl.Controls.Add(MyController)
    	MPEUC.Show()
    End Sub

    This is my MyUserControl.ascx

    GridView

    <div class="GVData">
    	<asp:GridView ID="gvBranch" runat="server" AutoGenerateColumns="False" EnableViewState="false" >
    		<Columns/>
    			<asp:BoundField DataField="BLoc" HeaderText="Location"/>
    			<asp:BoundField DataField="Bname" HeaderText="Name"/>
    		</Columns/>
    	</asp:GridView/>
    </div/>
    

    my TextBox for searching

    <asp:UpdatePanel ID="UpdateP1" runat="server" UpdateMode="Conditional">
    	<Triggers/>
    		<asp:AsyncPostBackTrigger ControlID="txtSearch" EventName="TextChanged" //>
    	</Triggers/>
    	<ContentTemplate>
    		<asp:TextBox ID="txtSearch" runat="server" EnableViewState="true" OnTextChanged="txtSearchBCode_TextChanged"/></asp:TextBox/>
    	</ContentTemplate/>
    </asp:UpdatePanel>




    Monday, January 27, 2014 12:50 AM

Answers

  • User555306248 posted

    Hi,

    Please create an UpdatePanel inside ModalPopup Panel and wrap the Content of Panel. Then ModalPopup will not be hidden.

    If enter key can't fire textChanged event, please define keypress client event of Textbox, and call __doPostBack('TextBoxID','') to do postback.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 27, 2014 10:26 PM

All replies

  • User555306248 posted

    Hi,

    Please create an UpdatePanel inside ModalPopup Panel and wrap the Content of Panel. Then ModalPopup will not be hidden.

    If enter key can't fire textChanged event, please define keypress client event of Textbox, and call __doPostBack('TextBoxID','') to do postback.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 27, 2014 10:26 PM
  • User-308948172 posted

    chetan.sarode

    Hi,

    Please create an UpdatePanel inside ModalPopup Panel and wrap the Content of Panel. Then ModalPopup will not be hidden.

    If enter key can't fire textChanged event, please define keypress client event of Textbox, and call __doPostBack('TextBoxID','') to do postback.

    My Modal will close if I define keypress event, I just want to Update My Gridview without closing the popup, then make a postback when I select an Item from my Gridview.

    Thanks for the replyLaughing

    UPDATE:

    I have modify my User Control with this code but still the event won't fire

    <asp:UpdatePanel ID="UpdateP1" runat="server" UpdateMode="Conditional">
    	<Triggers/>
    		<asp:AsyncPostBackTrigger ControlID="txtSearch" EventName="TextChanged" />
    	</Triggers/>
    	<ContentTemplate>
    		<asp:TextBox ID="txtSearch" runat="server" AutoPostBack="true"/>
    
    <div class="GVData">
    	<asp:GridView ID="gvBranch" runat="server" AutoGenerateColumns="False">
    		<Columns/>
    			<asp:BoundField DataField="BLoc" HeaderText="Location"/>
    			<asp:BoundField DataField="Bname" HeaderText="Name"/>
    		</Columns/>
    	</asp:GridView/>
    </div/>
    	</ContentTemplate/>
    </asp:UpdatePanel>

    Tuesday, January 28, 2014 12:56 AM