Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
153 views
Hi guys,

I am a newbie to Telerik controls. I am trying to implement exporting functionality on the grid to export only selected rows to CSV format as follows:

<CommandItemTemplate> 
                                            <table cellpadding="2" cellspacing="1" style="font-family: Tahoma; font-size: 11px" 
                                                width="100%"> 
                                                <tr> 
                                                    <td style="text-align: left"> 
                                                        <asp:LinkButton ID="hlInsertBank" runat="server" CommandName="InitInsert" Text="Insert"></asp:LinkButton> 
                                                    </td> 
                                                    <td style="text-align: right"> 
                                                        <asp:LinkButton ID="exportBankDetails" runat="server" Text="Export" CommandName="ExportToCSV" ></asp:LinkButton> 
                                                    </td> 
                                                </tr> 
                                            </table> 

On the server-side I have handled ItemCommand event as follows:

protected void RadGrid_Bank_ItemCommand(object sender, GridCommandEventArgs e) 
    { 
        RadGrid grid = (RadGrid)sender; 
        int itemIndex = e.Item.ItemIndex; 
        if (e.CommandName == "ExportToCSV") 
        { 
            foreach (GridDataItem dataItem in grid.MasterTableView.Items) 
            { 
                dataItemdataItem.Display = dataItem.Selected; 
            } 
            grid.MasterTableView.ExportToCSV(); 
        } 
    } 

But when i click the export link after selecting a few rows, nothing happens. It shows me the loading panel. It also goes into the server-side code and executes ExportToCSV(). Also another strange thing happens - the grid reduces to the records I have selected i.e. the page initially is set to show 5 records, and I select only 2 of it to export, once the call comes back from the exportToCSV(), it shows me only the 2 records which were selected. Also, when moving to the next page and back, everything comes to normal.I can all my records again.

Any ideas on what I am doing wrong?

Regards,
Princy
Top achievements
Rank 2
 answered on 21 May 2008
1 answer
99 views
In the project I'm working on, we're programaticaly adding nodes client side; for the most part everything works fine, but in some extreem circumstances, we may need to load around 3000 or so nodes. The trouble with this is that eventualy IE displays a 'Stop running this Script?' dialog to the user. After looking at the code, it seems like the slowest part of the process is calling the parentNode.add(childNode) method, which takes around 20-60ms per node (the rest of the code per node only takes about 5-10ms on top of this).

Are there any tips/suggestions you could give me to improve performance here, or at least prevent that IE dialog from being displayed?
Atanas Korchev
Telerik team
 answered on 21 May 2008
1 answer
114 views
I'm working using the grid control and am I'm trying to implement some paging.using the NeedDataSource event to grab a set amount of rows (20) into a datatable that is then bound to the grid.  That seems to work.  The problem is I don't get a pager control.  Is there some additional code I need or specific settings for it to display?  I would have thought I'd need to somehow feed it info on how many pages there will be but I can't find that in the documentation.

*solution*
Fixed this.  Found that you need to have the VirtualItemCount property set to a value for the pager to display.
Shinu
Top achievements
Rank 2
 answered on 21 May 2008
1 answer
456 views
I have a Grid showing a set of files.
When the user clicks on the column with the filename, the Code-Behind does something with this information.

To do this, I have data-bound this Grid with a table function returning the attributes ID and NAME (among others).

Within the Grid, I created a GridButtonColumn like this:

<telerik:GridButtonColumn CommandName="Select" DataTextField="name" HeaderText="File name" Text="Select" UniqueName="column">  
    <HeaderStyle Width="200px" /> 
</telerik:GridButtonColumn> 

Now I wish to somehow make sure that when the User clicks on the link displayed within this column, the CodeBehind can obtain the ID associated with the displayed NAME.

How do I do that?

What event is thrown when a user clicks into the GridButtonColumn?
How can I link the ID to the column items? Making sure that it shows the name NAME was trivial via DataTextField. But what do I do with the ID?

Thanks

s.

Princy
Top achievements
Rank 2
 answered on 21 May 2008
1 answer
115 views
I have a problem with the ScrollIntoView() method in that it is acting erratically.  Initially I had implemented this code:

    function pageLoad()
    {
     setTimeout('ScrollToSelectedNode()', 200);
    }

    function ScrollToSelectedNode()
    {
      var tree = <%= treeViewMain.ClientID %>;
      var selectedNode = tree.SelectedNode; 

      if (selectedNode != null)
         selectedNode.ScrollIntoView();
    }

But thinking about my application some, I realized that the ONLY time I needed ScrollIntoView() to be used was when I moved a node from one part of the main tree to another.  So in my server-side code I added this:

    nodeToMove.Attributes.Add("Moved", "1");

And then I altered the latter function like this:

    function ScrollToSelectedNode()
    {
      var tree = <%= treeViewMain.ClientID %>;
      var selectedNode = tree.SelectedNode;

      if (selectedNode != null && selectedNode.Attributes.Moved == "1")
      {
        selectedNode.ScrollIntoView();
        selectedNode.Attributes.Moved = "0";
      }
    }


My problem is this: I tried to remove the "Moved" attribute but couldn't figure out how.  And then when its value was [supposedly] set to "0" it didn't "stick".  On the next partial-postback its value had returned to "1" ... for reasons I don't understand.

Might anyone have any ideas?

Robert
Robert
Top achievements
Rank 1
 answered on 21 May 2008
1 answer
129 views
I can't seem to get to the DataKey or any Row Values from an ItemCommand event.  Even though I DO have GridCommandEventArgs e, the ROW is NOT selected, the grid is NOT in Edit mode and so the examples dont seem to work.

I merely have a button I want in a grid in each row called Verify and I need to know what DataKey it relates...  The rest of the grid is not editable.

Anyone have any ideas?
Shinu
Top achievements
Rank 2
 answered on 21 May 2008
1 answer
81 views
I'm new to all of this.  Few simple questions....
  1. Do I need to write any code to do simple updates, inserts and delete?  I dropped a grid on my asp.net form, clicked 'edit', made changes, clicked 'update' but the data was not updated.  Any idea what I'm doing wrong?
  2. What is the AJAX Manager used for?  Should I use this whenever I use the grid or any other control?

Thanks!

Shinu
Top achievements
Rank 2
 answered on 21 May 2008
1 answer
437 views
I am sure i just have a syntax error but i have been playing with this for over an hour and still can't figure it out. I have a page that opens a rad window from a javascript function and passes 2 querystring arguments as parameters. 

Here is the javascript to open the window:
<script type="text/javascript">  
 
        function openEditorWindow(forumID, typeofPost)  
        {  
            var oReadingWnd = radopen("PostEditor.aspx?ForumID=" + forumID + "&PostType=" + typeofPost);  
            oReadingWnd.Center();  
        }  
    </script> 

Here is the code-behind to set the buttons onclick event.
 lnkNewThread1.Attributes.Add("onclick", "javascript:openEditorWindow('" + this.Request.QueryString["ForumID"] + ", " + PostType.NewThread.ToString() + "')"); 

Here is the button that is supposed to launch the window.
<asp:HyperLink runat="server" ID="lnkNewThread1" NavigateUrl="#" ImageUrl="~/Images/forum_new_thread.png"   
                        Text="Start New Topic"/> 

When i load the page and click the link i get an exception that querystring format is invalid. When i inspect the querystring the javascript function is appending to the radwindow open call is looks like this:

?ForumID=1%2cNewThread&PostType=undefined

Obviously the javascript function is treating the parameters passed from the onclick event as a single string but i have no idea at this point how to format that onclick so that the javascript function grabs both variables. I found a million examples passing just a single parameter from onclick to a javascript function but can't seem to find any that pass two or more.
KevinMc
Top achievements
Rank 1
 answered on 21 May 2008
1 answer
114 views
Hi..

I have some general questions about ajax/telerik controls performance..

a) is any way to reduce number of calls to ScriptResource.axd during requests? i have application with radmenu which opens some radwindows and sometimes during loading one radwindow i have about 15 calls to that file.

b) i saw in firebug that images/js/css files requested in radwindow are not cached, is any know reason why they are not cached or how to tell browser to enable caching?

c) caching ms ajax ScriptResource file, it has about 45kb and is requested every time.. any way to cache it?

Regards
possible
Top achievements
Rank 1
 answered on 20 May 2008
26 answers
1.0K+ views
I updated my app to the latest Prometheus build (Q2 2007). 

I reference all of the Telerik DLLs through the BIN directory, not the GAC. Today, after I upgraded, one of my testers said he couldn't run the app because the file Telerik.Charting could not be found.

I'm not using Charting anywhere in the app, nor is the Charting assemblyincluded in the app's references.

Is there some dependency on the Charting assembly for the other controls that make it necessary to distribute Charting?

Chris Williams
Steve Elsbury
Top achievements
Rank 1
 answered on 20 May 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?