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

Clicking on icon does not postback

4 Answers 23 Views
Button
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 08 Jul 2014, 05:58 PM
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

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 09 Jul 2014, 05:34 AM
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
0
Matt
Top achievements
Rank 1
answered on 09 Jul 2014, 02:32 PM
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
0
Princy
Top achievements
Rank 1
answered on 10 Jul 2014, 04:04 AM
Hi Matt,

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

Thanks,
Princy
0
Matt
Top achievements
Rank 1
answered on 29 Jul 2014, 03:26 PM
Well, I never did figure out what was wrong.  I upgraded to the latest release (2014.2.724.40) and the problem solved itself.
Tags
Button
Asked by
Matt
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Share this question
or