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

Postbacks when using controls

1 Answer 63 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Casey
Top achievements
Rank 1
Casey asked on 05 Jul 2011, 02:58 PM
I have a webform which calls a control that creates a grid. One of the fields in the grid needs to run a method when the selection is changed. This causes the whole page to postback. I need it to only postback for a couple of the different items contained within the grid. I have tried several different solutions (adding a radajaxmanager, a radajaxproxy, adding the ajaxsettings in the code behind, etc) without success. I'm sure there is something real basic I am overlooking. Could someone please point me in the right direction? Thanks!

Test.aspx

 

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test.aspx.vb" Inherits="Project.Test" %>

 

<%@ Register src="../controls/cntControl.ascx" tagname="cntControl" tagprefix="uc1" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title></title>

    <script type="text/javascript">   

      function pageLoad() {

      }   

    </script>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">

        </telerik:RadScriptManager>

        <uc1:cntAttibuteOptionTypes ID="cntControl1" runat="server" />

    </div>

    </form>

</body>

</html>

 

 


cntControl.ascx

 

<%@ Control Language="vb" AutoEventWireup="false" Codebehind="cntControl.ascx.vb" Inherits="Project.cntControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<meta content="False" name="vs_snapToGrid" />

<P>

<telerik:RadGrid ID="dgOptions" runat="server" CellSpacing="0" GridLines="None"

    ShowHeader="False" Skin="Web20" AutoGenerateColumns="false"

    BorderStyle="None">

<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>

 

    <ItemStyle BorderStyle="None" Wrap="False" />

 

<MasterTableView nodetailrecordstext="" nomasterrecordstext="">

<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

 

<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>

 

<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>

<Columns>

                  <telerik:GridBoundColumn DataField="displaytext" ItemStyle-Wrap="False">

                      <ItemStyle Width="185px" />

                  </telerik:GridBoundColumn>

                  <telerik:GridBoundColumn Visible="False" DataField="OptionTypeCd"></telerik:GridBoundColumn>

                  <telerik:GridTemplateColumn>

                        <ItemTemplate>

                              <asp:DropDownList id="ddlProdOption" AutoPostBack="true" OnSelectedIndexChanged="DropDown_SelectedIndexChanged"

                                    runat="server"></asp:DropDownList>

                        </ItemTemplate>

                  </telerik:GridTemplateColumn>

                        <ItemTemplate>

                              <asp:TextBox ID="txtProdOption" Runat="server" Width="200px"></asp:TextBox>

                        </ItemTemplate>

                  </telerik:GridTemplateColumn>

                  <telerik:GridTemplateColumn>

                        <ItemTemplate>

                              <asp:TextBox ID="txtImage" runat="server" Width="70"></asp:TextBox>&nbsp;

                        </ItemTemplate>

                  </telerik:GridTemplateColumn>

                  <telerik:GridTemplateColumn>

                        <ItemTemplate>

                              <asp:TextBox ID="txtLrgImage" Runat="server"></asp:TextBox>&nbsp;

                        </ItemTemplate>

                  </telerik:GridTemplateColumn>

</Columns>

<EditFormSettings>

<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>

</EditFormSettings>

</MasterTableView>

 

<FilterMenu EnableImageSprites="False"></FilterMenu>

</telerik:RadGrid>

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

    <AjaxSettings>

 

        <telerik:AjaxSetting AjaxControlID="dgOptions">

            <UpdatedControls>

                <telerik:AjaxUpdatedControl ControlID="dgOptions" />

            </UpdatedControls>

        </telerik:AjaxSetting>

 

    </AjaxSettings>

</telerik:RadAjaxManager>

<p>

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 08 Jul 2011, 09:53 AM
Hi Casey,

Tha ajax settings you added a proper so there is no obvisous reason for the postback to happen. Can you check if you have any javascript errors on the page? Or troubleshoot the web resources as suggested here.

Additionally, I prepared a sample based on your code. Try to run it on your end and let me know how it goes and if something differs from your case.

All the best,
Iana
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Ajax
Asked by
Casey
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or