In my ASP.NET web project, i am using a web user control in a web form to generate insert/update/delete operations for the data in the web form.
<asp:UpdatePanel runat="server" ID="ctlUcusUpdatePanel">
<ContentTemplate>
<uc1:UcusBilgileriEditor runat="server" ID="ctlUcusBilgileriEditor" />
<%-- Here I have a grid to display data--%>
</ContentTemplate>
</asp:UpdatePanel>
Here is my user control:
<asp:UpdatePanel ID="ctlEditorUpdatePanel" runat="server">
<ContentTemplate>
<asp:Panel runat="server" ID="ctlEditorContentPanel" Visible="false">
<div class="panel panel-primary" id="ctlUcusBilgiModal" style="position: relative; top: auto; left: auto; right: auto; margin: 0 auto 20px; z-index: 1; width: 100%; display: none">
<div class="panel-heading">
<div class="panel-title">
<hzg:HZGLiteral runat="server" ID="ctlModalTitle"></hzg:HZGLiteral>
</div>
</div>
<div class="panel-body" style="padding: 20px 20px 2px 2px;">
<ul id="myTab" class="nav nav-tabs">
<li class="active"><a href="#general" data-toggle="tab">Genel</a></li>
<li class=""><a href="#other" data-toggle="tab">Uçuş Detayları</a></li>
<li class=""><a href="#notes" data-toggle="tab">Açıklamalar</a></li>
</ul>
<div class=tab-content>
<div class="form-group col-sm-1">
<label class="control-label" for="<%= ctlFlightMoveType.ClientID %>">
<asp:Literal runat="server" ID="ctlFLightMoveLiteral" meta:resourcekey="ctlFlightMoveTypeLiteral" />
</label>
<hzg:HZGRadioButtonList ID="ctlFlightMoveType"
AutoPostBack="true"
CellPadding="3"
RepeatColumns="5"
RepeatDirection="Vertical"
TextAlign="Right"
runat="server"
DataValueField="INISMI"
EnumType="HZG.Core.Model.Enums.FlightMove"
OnSelectedIndexChanged="ctlFlightMoveType_SelectedIndexChanged">
</hzg:HZGRadioButtonList>
</div>
</div>
</div>
<div class="panel-footer" style="text-align: right">
<hzg:HZGButton ID="ctlSaveButton" runat="server" ButtonDesign="success" ButtonSize="small" Text="Kaydet" OnClick="ctlSaveButton_Click" meta:resourcekey="ctlSaveButton" RolePermission="Admin,PowerUser,User" />
<hzg:HZGButton ID="ctlDeleteButton" runat="server" ButtonDesign="danger" ButtonSize="small" Text="Delete" OnClick="ctlDelete_Click" meta:resourcekey="ctlDeleteButton" OnClientClick='<%$ Resources:GlobalResource, AreYouSure%>' RolePermission="Admin,PowerUser,User" />
<hzg:HZGButton ID="ctlCloseButton" runat="server" ButtonDesign="primary" ButtonSize="small" Text="İptal" OnClick="ctlCloseButton_Click" meta:resourcekey="ctlCloseButton" />
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
When I click on a radiobutton in my RadiButtonList, ctlFlightMoveType_SelectedIndexChanged event is triggered; and when this happens, i want only my user control to postback but my web form postback and the user control is closed.
I dont want the webform to postback, i want only user control. How can i do this?
Please, read the AJAX overview, you can also read up about ScriptManager and UpdatePanel. Using
UpdatePanel
you can achieve the feature described in your question.