This is a migrated thread and some comments may be shown as answers.

How to prevent PostBack while clicking button in ASP.NET

0 Answers 417 Views
AjaxPanel
This is a migrated thread and some comments may be shown as answers.
Omid
Top achievements
Rank 1
Omid asked on 28 Feb 2017, 09:16 AM
Hi, 
In the following code you can see the RedGrid sample that has 2 buttons, one of them for edit and other for remove columns. When i click on the Edit or Remove button, one request send to server with Ajax but i have problem! 
What is Problem?
This sample help me for send Ajax request to server but i want prevent to postback grid and when Edit-Button code behind called Grid.Rebind() grid has been update.
Thx you.
Nasri.
<septa:SeptaRadAjaxManagerProxy runat="server" ID="prox">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="prox">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdPropertyGroups" />
                <telerik:AjaxUpdatedControl ControlID="grdCrmObjectTypeFields" />
                <telerik:AjaxUpdatedControl ControlID="btnNewField" UpdatePanelCssClass="inline-block" />
                <telerik:AjaxUpdatedControl ControlID="btnNewGroup" UpdatePanelCssClass="inline-block" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="grdCrmObjectTypeFields">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdCrmObjectTypeFields" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="btnNewField">
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="btnNewGroup">
        </telerik:AjaxSetting>
    </AjaxSettings>
</septa:SeptaRadAjaxManagerProxy>
<div class="row">
    <div class="col-sm-6">
        <div class="card mt15">
            <div class="card-block">
                <h3>
                    <septa:LocalizedLiteral ID="LocalizedLiteral2" runat="server"ResourceKey="Res.General.Literal.EditCrmObjectType_FieldsGroup"></septa:LocalizedLiteral>
                </h3>
                <hr class="mtn" />
                <div class="table-responsive">
                    <septa:SeptaGrid ID="grdPropertyGroups" runat="server" OnItemCommand="grdPropertyGroups_ItemCommand"
                        OnNeedDataSource="grdPropertyGroups_NeedDataSource" AutoGenerateColumns="false"
                        OnItemCreated="grdPropertyGroups_ItemCreated" Width="100%">
                        <MasterTableView CommandItemDisplay="Top" DataKeyNames="Id">
                            <CommandItemSettings ShowRefreshButton="false" ShowAddNewRecordButton="false" />
                            <Columns>
                                <septa:LocalizedGridDataBoundColumn DataField="Name" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"></septa:LocalizedGridDataBoundColumn>
                                <telerik:GridButtonColumn UniqueName="btnEdit" CommandName="EditItem"ButtonType="ImageButton" ImageUrl="/_SiteCommon/Images/edit2.png"></telerik:GridButtonColumn>
                                <telerik:GridButtonColumn UniqueName="btnDel" ButtonType="ImageButton"ConfirmDialogType="Classic"
                                    CommandName="DeleteItem" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    ImageUrl="/_sitecommon/images/delete-icon.png">
                                </telerik:GridButtonColumn>
                                <telerik:GridTemplateColumn HeaderText="" HeaderStyle-HorizontalAlign="Center"ItemStyle-HorizontalAlign="Center"
                                    HeaderStyle-Width="40px">
                                    <ItemTemplate>
                                        <asp:ImageButton runat="server" ID="lnkDown"ImageUrl="/_SiteCommon/images/public/down.png"
                                            ToolTip='<%# LocalisationHelper.GetResourceValue(Res.General.Literal.General_Down) %>'
                                            CommandName="MoveDown" />
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="" HeaderStyle-HorizontalAlign="Center"ItemStyle-HorizontalAlign="Center"
                                    HeaderStyle-Width="40px">
                                    <ItemTemplate>
                                        <asp:ImageButton runat="server" ID="lnkUp"ImageUrl="/_SiteCommon/images/public/up.png"
                                            ToolTip='<%# LocalisationHelper.GetResourceValue(Res.General.Literal.General_Up) %>'
                                            CommandName="MoveUp" />
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                        </MasterTableView>
                    </septa:SeptaGrid>
                </div>
            </div>
            <div class="card-footer text-left">
                <septa:LocalizedButton ID="btnNewGroup" runat="server" OnClick="btnNewGroup_Click" SkinID="AddBtn" />
            </div>
        </div>
    </div>

No answers yet. Maybe you can help?

Tags
AjaxPanel
Asked by
Omid
Top achievements
Rank 1
Share this question
or