Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
286 views
I've got a radupload control in a radgrid insert/edit dialog. The operation of specifying the file for upload in the insert/edit operation works great. I am able to created new records and update old records in the grid.

One problem, after I create a new record and the upload operation is complete, the dialog is closed with the grid displayed normally,  if I refresh my browser a new duplicate record is created. This doesn't happen for other radgrids I have with insert/edit operation that don't contain an upload control.

I see this same issue on the RadUpload demo page in the upload in a grid example. To reproduce this issue, add a new file. After the new record is created, refresh the page and the demo will show a duplicate.

--Mark
Hassan Yasir
Top achievements
Rank 1
 answered on 24 Apr 2010
2 answers
95 views
Hello,

I have the following scenario (dynamically created during runtime):

A RadGrid
A RadTabStrip

Depending on the sort column and type of the radgrid, the radtabstrip shows different tabs like (for a string column):

"Show all"
"A-C"
"D-F"
etc.

When clicking on one of the tabs, the database call is adjusted so only the corresponding sets are returned.

I added an RadAjaxManager, adding the following settings during runtime (this.ContentAwarePager is a class overloading the RadTabStrip):

                   
                    if (this.ContentAwarePager != null) 
                    { 
                        AjaxUpdatedControl ucgrid = new AjaxUpdatedControl(); 
                        ucgrid.ControlID = this.ID; 
 
                        AjaxUpdatedControl ucpager = new AjaxUpdatedControl(); 
                        ucpager.ControlID = (this.ContentAwarePager as WebControl).ID; 
 
                        AjaxSetting gridtopager = new AjaxSetting(); 
                        gridtopager.AjaxControlID = this.ID; 
                        gridtopager.UpdatedControls.Add(ucgrid); 
                        gridtopager.UpdatedControls.Add(ucpager); 
 
                        ram.AjaxSettings.Add(gridtopager); 
 
                        AjaxSetting pagertogrid = new AjaxSetting(); 
                        gridtopager.AjaxControlID = (this.ContentAwarePager as WebControl).ID; 
                        gridtopager.UpdatedControls.Add(ucgrid); 
                        gridtopager.UpdatedControls.Add(ucpager); 
 
                        ram.AjaxSettings.Add(pagertogrid); 
                    } 

Furthermore, I have a listener on TabClicked, which rebinds the datagrid.

When I click on a tab, everything works fine, and the ajaxmanager correctly handles the updating of the grid.

But when I catch the sort event, and remove and add tabs to the TabStrip (depending on the type of the column), the RadTabStrip is not "redrawn", if you know what I mean.

Is there a possibility to achieve this behaviour through the RadAjaxManager?

best regards for your help

Ulrik
Ulrich
Top achievements
Rank 1
 answered on 24 Apr 2010
3 answers
170 views

Hi All -
I'm pulling my hair out a bit -- I have a self-referencing hierarchical grid and I want to automatically scroll to the selected record when I post back (when adding or editing a record). I can select the record on postback fine, and when the record is in the master tableview the position works, but if the selected record is in a child tableview, the position does not work. Below is the code I am using... any ideas?

Thanks
Ford





           function GridCreated() {  
            // This code will position visible part of grid on selected item even when item is off visible area

               var RadGrid1 = $find("<%= RadGrid1.ClientID %>");
               var found = 0;

              // look for selected row in master table
              var row = RadGrid1.get_masterTableView().get_selectedItems()[0];
                
              if (row) {
                  found = 1;
              //    alert('In Master');

              }

              else {

                 // alert("not found in parent");
                  for (var j = 0; j < RadGrid1.get_detailTables().length; j++) {
                      var childSelectedRows = RadGrid1.get_detailTables()[j].get_selectedItems();
                  }
                  var childSelIDs = new Array(childSelectedRows.length);
                  for (var i = 0; i < childSelectedRows.length; i++) {
                      var row = childSelectedRows[i];
                      if (row) {
                          found = 1;
                  //        alert('In Child');
                      }

                  }
               }

                 // alert('testing');

                  if (found == 1) {
                      alert('positining');
                      setTimeout(function() {
                          var rowElement = row.get_element();
                          //get the main table scrollArea HTML element
                          var scrollArea = RadGrid1.GridDataDiv;

                          //check if the selected row is below the viewable grid area
                          if ((rowElement.offsetTop - scrollArea.scrollTop) + rowElement.offsetHeight + 20 > scrollArea.offsetHeight) {
                              //scroll down to selected row
                              scrollArea.scrollTop = scrollArea.scrollTop + (rowElement.offsetTop - scrollArea.scrollTop) + (rowElement.offsetHeight - scrollArea.offsetHeight) + rowElement.offsetHeight;
                          }
                          //chck if the selected row is above the viewable grid area
                          else if ((rowElement.offsetTop - scrollArea.scrollTop) < 0) {
                              //scroll the selected row to the top
                              scrollArea.scrollTop = rowElement.offsetTop;
                          }
                      }, 200);
                  }
             }
Maas Prog
Top achievements
Rank 1
 answered on 23 Apr 2010
1 answer
91 views
hello
Using SQL2k environment and do not have SQLCacheDependancy running. I am loading my data via the conventional cache method

 

 

 

sub bindgrid()
Dim d As 
DataTable = CType(Cache("MyCache"), Data.DataTable)  
If d Is Nothing Then  
d = functions.dt("Select top 100* from table")  
Cache.Insert("MyCache", d, Nothing, DateTime.Now.AddSeconds(30), TimeSpan.Zero)  
status.innerhtml = "data loaded from database" 
Else  
status.innerhtml = "Data loaded from cache" 
End If  
RadGrid1.DataSource = d  
end sub
 

I am calling the sub from within the needdatasource event. so now the grid loads either cached or fresh data. I am handling paging via calling bindgrid() again and setting pageindex to newpageindex.

This works fine. When I go into edit mode and incorporate the GridEditableitem method and update the selected row this also works fine except that the cached data now no longer matches the updated data. until the cache is rebuilt or I manually remove the cache on updated.

        If e.CommandName = "Update" Then  
            Dim ei As GridEditableItem = TryCast(e.Item, GridEditableItem)  
            Dim pk As String = ei.OwnerTableView.DataKeyValues(ei.ItemIndex)("keyid").ToString()  
            Dim empid As String = TryCast(ei("Emp_ID").Controls(0), TextBox).Text  
            Dim sql As String = "update table set emp_id = '" & empid & "' where keyid = " & pk  
            functions.Scalar(sql)  
            Cache.Remove("MyCache") 'If I don't kill the cache I end up with the old values.  
            bindgrid()  
        End If 

Do you have any method or trick to updating the grid to the new values without having to rebuild the cache? I suppose I could somehow extract the datatable from the cache, loop through the datatable, find the affected row, somehow update the column and reset the grid... but that seems pretty laborious.



mac
Top achievements
Rank 1
 answered on 23 Apr 2010
0 answers
111 views

Following  are  2 paneltems in the panel bar.  On button click of btnAddAccountChecking I am trying to expand  CheckingAddUserControl panel item. It does expand the panel item but after that it breaks on Telerik general   undefined object null javascript error  .

This is the code to attach java function for CheckingAddUserControl Client side processing.

Dim btnAddChecking As ImageButton = CType(pnlTopLevel.Items().FindItemByValue("CheckingAdd").Items().FindItemByValue("CheckingAddbtn").FindControl("btnAddAccountChecking"), ImageButton)

Dim openWinScript As String = "SetVisibility('CheckingAddUserControl');"

                  btnAddChecking.OnClientClick = openWinScript

This is the JavaScript Function:

     <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  

    <script type="text/javascript">

           

            function SetVisibility(itemValue) {

                  var panelBar = $find("<%= pnlBarAccounts.ClientID %>");

                  var panelItem = panelBar.findItemByValue(itemValue);

                  panelItem.expand();

         }

            

    </script>

</telerik:RadCodeBlock>

These are the panelitems

 

<telerik:RadPanelItem value="CheckingAdd" runat="server" Text="CheckingAdd" Expanded="true" style="display:none;">

                                                <Items>

                                                      <telerik:RadPanelItem value="CheckingAddbtn" runat="server" Text="" Expanded="true">

                                                            <ItemTemplate>

                                                                  <br />

                                                                  <asp:ImageButton ID="btnAddAccountChecking" runat="server"  />

                                                            </ItemTemplate> 

                                                      </telerik:RadPanelItem>

                                                </Items>

                                                 </telerik:RadPanelItem>

                                          <telerik:RadPanelItem value="CheckingAddUserControl" runat="server" Expanded="false" Visible="true">

                                                <Items>    

                                                      <telerik:RadPanelItem  runat="server" Expanded="true" >

                                                            <ItemTemplate>

                                                                  <UC1:CheckingAcct ID="CheckingAcct1" runat="server"   AcctID="0" />

                                                            </ItemTemplate> 

                                                      </telerik:RadPanelItem>

                                                </Items>

                                          </telerik:RadPanelItem>

A K
Top achievements
Rank 1
 asked on 23 Apr 2010
2 answers
156 views
Hi,

I want to create a pie chart like the attached image 'GraphNeeded.jpg' but I am not able to remove the outer border which contains the caption text( I am only able to create the pie chart like 'Piechart.png' ). Is there any way to

1. Remove the outer border coming with pie chart
2. Any way to align pie chart to left and the legend to right inside pie chart area
3. Provide an underline to view all


Please advice.

Thanks,
Pramod M
Pramod M
Top achievements
Rank 1
 answered on 23 Apr 2010
6 answers
248 views
I am not sure why this is happening, but it ONLY happens when exporting to Excel.  I have this same export functionality on other pages that work fine, for some reason this page doesn't like it and I am not sure why.

I specify the file name and format on the grid itself and then simply have these buttons:
<asp:ImageButton ID="btn_ExportCSV" runat="server" 
                OnClick="btn_ExportCSV_Click" BorderColor="#F0A54E"  
                BorderStyle="Ridge"  
                ImageUrl="~/images/export_csv.jpg" />&nbsp;&nbsp;&nbsp;&nbsp; 
            <asp:ImageButton ID="btn_ExportEXCEL" runat="server" 
                OnClick="btn_ExportEXCEL_Click" BorderColor="#F0A54E"  
                BorderStyle="Ridge"  
                ImageUrl="~/images/export_excel.jpg" />&nbsp;&nbsp;&nbsp;&nbsp; 
            <asp:ImageButton ID="btn_ExportWORD" runat="server" 
                OnClick="btn_ExportWORD_Click" BorderColor="#F0A54E"  
                BorderStyle="Ridge"  
                ImageUrl="~/images/export_word.jpg" />         
 Protected Sub btn_ExportEXCEL_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_ExportEXCEL.Click 
        ConfigureExport() 
        grid_applications.MasterTableView.ExportToExcel() 
    End Sub 
 
    Protected Sub btn_ExportWORD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_ExportWORD.Click 
        ConfigureExport() 
        grid_applications.MasterTableView.ExportToWord() 
    End Sub 
 
    Protected Sub btn_ExportCSV_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_ExportCSV.Click 
        ConfigureExport() 
        grid_applications.MasterTableView.ExportToCSV() 
    End Sub 
 
 
    Public Sub ConfigureExport() 
 
        For x = 2 To 22 'display only columns I want 
 
            grid_applications.MasterTableView.Columns(x).Visible = True 
 
        Next 
 
    End Sub 

When I click CSV or WORD it works fine. When i click Excel Export I get:

The RegisterRequiresViewStateEncryption() method needs to be called before or during Page_PreRender.

Line 131:                BorderStyle="Ridge" 
Line 132:                ImageUrl="~/images/export_word.jpg" />        
Line 133:<telerik:RadGrid ID="grid_applications" runat="server" DataSourceID="sqlds_Applications" 
Line 134:        GridLines="None" Width="1100px" AllowFilteringByColumn="True" 
Line 135:        AllowPaging="True" AllowSorting="True" PageSize="30" ShowGroupPanel="True">




Bruno
Top achievements
Rank 2
 answered on 23 Apr 2010
3 answers
375 views
I have a RadCodeBlock defined on my page with some JS code but I need to add more JS script dynamically/programatically.
Can someone help?

Chris
Libertas Technologies
Top achievements
Rank 1
 answered on 23 Apr 2010
4 answers
205 views
Hi,

in my application, there are some RadPanes inside an RadSlidingPane which is inside an RadSlidingZone filling the entire page. Is it possible to have scrolling enabled in one of these nested RadPanes?

It seems as if there are scrollbars, but they aren't visible. I tried many tricks I found on your website but without results.

Best regards
Lucas
Lucas Bonifacius
Top achievements
Rank 1
 answered on 23 Apr 2010
2 answers
245 views
Hi there!

I need to set a mask for the input of a combobox. Does this component already has any capability to do this by itself? If I attach an event to the textbox (_input) of the combobox, would it be overriden by the filter's property default behaviour?

I´d really appreciate any help

Best regards

Eduardo.
Eduardo Oliveira
Top achievements
Rank 1
 answered on 23 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?