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

How to make Refresh button for RadGrid to work

7 Answers 343 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rajesh
Top achievements
Rank 1
Rajesh asked on 01 Aug 2011, 10:26 AM
Hi,

I have configured the CommandItemSetting of RadGrid to diplay Refresh button. But on clicking the button nothing happens.

Do I need to wire it up to any function? There is nothing mentioned any thing about this in Telerik demo.

-Rajesh

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 01 Aug 2011, 10:48 AM
Hello Rajesh,

You can check for the CommandName of the Refresh button in the ItemCommand event of the RadGrid.

C#:
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
  if (e.CommandName == RadGrid.RebindGridCommandName)
  {
  }
}

Thanks,
Shinu.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 01 Aug 2011, 07:08 PM
Hi,

 <asp:Button ID="btnRebindGrid" CommandName="RebindGrid" runat="server" />
if you are not used  Advanced Data Binding for bind datasource then bind datasource and again.



Thanks,
Jayesh Goyani
0
MTC
Top achievements
Rank 1
answered on 07 Feb 2013, 09:41 AM
Hi all,
i am using RadAjaxManager in the rad grid. 
on button click i am updating a record in database and after successful update i want the grid also to be updated without postback.
i have tried with Rebind() and DataBind() but both r not working for me.
also i want to specify that i am using advance data binding (NeedDataSource).

  <telerik:RadAjaxManager ID="tlkRadAjaxMgr" runat="server" DefaultLoadingPanelID="tlkRadAjaxLoadingPanels">
                        <AjaxSettings>
                            <telerik:AjaxSetting AjaxControlID="rg_ViewTickets">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="rg_ViewTickets" />
                                      <telerik:AjaxUpdatedControl ControlID="btnUpdate" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
                    </telerik:RadAjaxManager>
0
Jayesh Goyani
Top achievements
Rank 2
answered on 07 Feb 2013, 10:12 AM
Hello,

<telerik:RadAjaxManager ID="tlkRadAjaxMgr" runat="server" DefaultLoadingPanelID="tlkRadAjaxLoadingPanels">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnUpdate">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rg_ViewTickets" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rg_ViewTickets">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rg_ViewTickets" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>


Thanks,
Jayesh Goyani
0
MTC
Top achievements
Rank 1
answered on 07 Feb 2013, 12:35 PM
  
Hi Jayesh,
I have followed your suggestion and its working fine.
thanks for the help..:)
0
MTC
Top achievements
Rank 1
answered on 12 Feb 2013, 11:34 AM
Hi All..
I am using RadAjaxManager and RadAjaxLoadingPanel with RadGrid. On grid column i have asp linkbutton and on that link button click i am calling one javascript function..
everything is working fine but on that link button click i am not able to show loading panel and also post back occurs :(
below is my code :

 ajax setting is :
 <telerik:AjaxSetting AjaxControlID="lnkbtnDownload">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="rg_Attachments" LoadingPanelID="tlkRadAjaxLoadingPnl" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
On Grid i have asp link button on  GridTemplateColumn like:

  <telerik:GridTemplateColumn HeaderText="Download">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkDownload" runat="server" Text="Download" OnClientClick="return downloadpdf(id);"
                                            ForeColor="Blue"></asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>

and this is my javascript function:
 <script language="javascript" type="text/javascript">
        function downloadpdf(id) {
            var annid = id.replace("lnkDownload", "annId");
            window.location = "DownloadAttachment.ashx?id=" + document.getElementById(annid).value;
            return false;
        }
    </script>


Please help........
0
Princy
Top achievements
Rank 1
answered on 14 Feb 2013, 01:21 PM
Hi Shweta,

Please have a look into the following code.

ASPX:
<asp:ScriptManager ID="ScriptManager1" runat="server" />
  <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" CssClass="MyAjaxLoadingPanel"
      Transparency="20" MinDisplayTime="1000" />
  <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
      <AjaxSettings>
          <telerik:AjaxSetting AjaxControlID="RadGrid1">
              <UpdatedControls>
                  <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
              </UpdatedControls>
          </telerik:AjaxSetting>
      </AjaxSettings>
  </telerik:RadAjaxManager>
 
  <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" DataSourceID="SqlDataSource1">
      <MasterTableView CommandItemDisplay="Top">
          <Columns>
              <telerik:GridButtonColumn CommandName="Edit" Text="edit">
              </telerik:GridButtonColumn>
              <telerik:GridTemplateColumn HeaderText="Download">
                  <ItemTemplate>
                      <asp:LinkButton ID="lnkDownload" runat="server" Text="Download" OnClientClick="return downloadpdf(id);"
                          ForeColor="Blue"></asp:LinkButton>
                  </ItemTemplate>
              </telerik:GridTemplateColumn>
          </Columns>
      </MasterTableView>
  </telerik:RadGrid>
  <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
      SelectCommand="SELECT * from Employees"></asp:SqlDataSource>

CSS:
<style type="text/css">
       .MyAjaxLoadingPanel
       {
           background: #fff url('loading.gif') center center no-repeat;
       }
   </style>

JavaScript:
<script language="javascript" type="text/javascript">
    function downloadpdf(id) {
        var annid = id.replace("lnkDownload", "annId");
        window.location = "DownloadAttachment.ashx?id=" + document.getElementById(annid).value;
        return false;
    }
</script>

Thanks,
Princy.
Tags
Grid
Asked by
Rajesh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
MTC
Top achievements
Rank 1
Princy
Top achievements
Rank 1
Share this question
or