Clicking on icon does not postback

5 posts, 0 answers
  1. Matt
    Matt avatar
    32 posts
    Member since:
    May 2013

    Posted 08 Jul 2014 Link to this post

    Greetings,

    I have several RadButtons in my application that are opening a RadWindow from the code-behind.  If I click on the embedded icon (Icon-PrimaryIconCssClass="rbEdit"), nothing happens.  If I click on the text, then it does a postback and opens the window.  This does not happen on any other buttons, only the ones that are opening a RadWindow.  Here is an example where btnEditUser in the GridTemplateColumn will only post back if you click the word "Edit".  It does not post back if you click the rbEdit icon.

    <telerik:RadGrid ID="grdUsers" runat="server" AllowPaging="True" AllowSorting="True"
                      AutoGenerateColumns="False" CellSpacing="0" GridLines="None" ShowGroupPanel="True"
                      DataSourceID="objUsers" OnItemDataBound="grdUsers_ItemDataBound">
      <ClientSettings AllowDragToGroup="True">
      </ClientSettings>
      <ExportSettings ExportOnlyData="true" HideStructureColumns="true" IgnorePaging="true"
                      OpenInNewWindow="true" SuppressColumnDataFormatStrings="true">
      </ExportSettings>
      <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="UserID" DataSourceID="objUsers">
        <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToCsvButton="true" />
        <HeaderStyle Font-Bold="true" HorizontalAlign="Left" />
        <PagerStyle PageSizes="10,25,50,100,250" AlwaysVisible="true" />
        <Columns>
          <telerik:GridBoundColumn DataField="UserName" FilterControlAltText="Filter Name column"
                                    HeaderText="Name" SortExpression="UserName" UniqueName="UserName">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="UserLogin" FilterControlAltText="Filter Login column"
                                    HeaderText="Login" SortExpression="UserLogin" UniqueName="UserLogin">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="UserEmail" FilterControlAltText="Filter Email column"
                                    HeaderText="Email" SortExpression="UserEmail" UniqueName="UserEmail">
          </telerik:GridBoundColumn>
          <telerik:GridTemplateColumn FilterControlAltText="Filter Phone column" HeaderText="Phone"
                                      SortExpression="UserPhone" UniqueName="UserPhone">
            <ItemTemplate>
              <asp:Label ID="lblUserPhone" runat="server" Text='<%# FormatPhone(Eval("UserPhone").ToString()) %>'>></asp:Label>
            </ItemTemplate>
          </telerik:GridTemplateColumn>
          <telerik:GridCheckBoxColumn DataField="UserActive" DataType="System.Boolean" FilterControlAltText="Filter Active column"
                                      HeaderText="Active" SortExpression="UserActive" UniqueName="UserActive" ItemStyle-HorizontalAlign="Center">
          </telerik:GridCheckBoxColumn>
          <telerik:GridTemplateColumn Groupable="false" AllowFiltering="false" ShowSortIcon="false"
                                      ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
              <telerik:RadButton ID="btnEditUser" runat="server" Font-Bold="True" Icon-PrimaryIconCssClass="rbEdit"
                                  CommandArgument='<%# Eval("UserID") %>' Text="Edit" OnCommand="btnEditUser_Command">
              </telerik:RadButton>
            </ItemTemplate>
          </telerik:GridTemplateColumn>
        </Columns>
      </MasterTableView>
    </telerik:RadGrid>

    Code-Behind...

    protected void btnEditUser_Command(object sender, CommandEventArgs e)
    {
      string userID = e.CommandArgument.ToString();
      RadWindow newWindow = new RadWindow();
      newWindow.OnClientClose = "RefreshUsers";
      newWindow.VisibleOnPageLoad = true;
      newWindow.KeepInScreenBounds = true;
      newWindow.Height = Unit.Parse("790");
      newWindow.Width = Unit.Parse("750");
      newWindow.NavigateUrl = "~/UserWindow.aspx?userid=" +
                              userID;
      wndDetailsMgr.Windows.Add(newWindow);
    }

    Any ideas how to fix this?  Your help is appreciated.

    Matt
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 09 Jul 2014 in reply to Matt Link to this post

    Hi Matt,

    Your code works fine at my end. Please make sure you have OnClientClose function written and nothing in it is causing issue for the window to open.

    C#:
    newWindow.OnClientClose = "RefreshUsers";

    JS:
    <script type="text/javascript">
      function RefreshUsers() {
          alert("Fired");
        }
    </script>

    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Matt
    Matt avatar
    32 posts
    Member since:
    May 2013

    Posted 09 Jul 2014 in reply to Princy Link to this post

    The window opens just fine and OnClientClose is working properly too.  The only issue is that clicking the button on top of the embedded icon does not fire the button click event.  If I click over the text on the button, then it fires and everything works as expected.

    Matt
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 09 Jul 2014 in reply to Matt Link to this post

    Hi Matt,

    Unfortunately I'm unable to replicate this issue at my end. Your code works fine at my end.

    Thanks,
    Princy
  6. Matt
    Matt avatar
    32 posts
    Member since:
    May 2013

    Posted 29 Jul 2014 Link to this post

    Well, I never did figure out what was wrong.  I upgraded to the latest release (2014.2.724.40) and the problem solved itself.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017