Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
129 views
I'm guessing that my problem is because of a limitation i found here client side binding specifics :"Data editing and grid editors. Since the control is bound on the client, and no subsequent trips are made to the server, the default editors cannot be rendered, and shown, which is the standard behavior, when the grid is bound on the server."  So I assume I'll need to add an external edit form as suggested. Please let me know if that is the case, or if I'm simply missing something below.

I have a radgrid with a number of gridtemplatecolumns, most of which contain radtextboxes, radnumerictextboxes and radcomboboxes that the user can edit at any time, without setting individual columns in edit mode. This all worked well using server side binding, but was slow (my customer needs to be able to add and save new rows in about 1 second or less, partial postbacks are taking ~4 seconds).
I am now attempting to get client side binding to work, and have hit a roadblock while trying to add a new row on the client side. I see that a new row is added below my other rows, but only the GridClientSelectColumn's checkbox on the leftmost column is displayed on the new row, all the template columns with textboxes and comboboxes are blank, not just empty controls, the controls aren't in the new column at all.


I call AddNewRow() to add a row, getValues() is a js function which supplies the default values for the new row, and InsertRowToDataSource() webservice returns a JSON string of the current grid data plus one new row with default values (e.g. [{id:"123", RoomName:"x"}, {id:"456", RoomName:"y"}]  ) and finally, on rowdatabound, RadGrid1_RowDataBound(...) is called so i can set values on my template controls. However, my template controls appear to not exist on the new row.
       
function AddNewRow()
        {
            wsLookup.InsertRowToDataSource(getValues(), updateGrid);
            return false;
        }
         
        function updateGrid(result)
        {
            var ds = eval(result);
            var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
            tableView.set_dataSource(ds);
            tableView.dataBind();
        }
        function RadGrid1_RowDataBound(sender, args)
        {
            var room = args.get_item().findControl("rtbRoom");  // var room is null on the new row
            room.set_value(args.get_dataItem()["RoomName"]);
        }

and here is my radgrid (with some columns omitted):
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSourceAudit" EnableAJAX="True" EnableOutsideScripts="True"
     AutoGenerateColumns="False" GridLines="None" Width="100%" Height = "100%" PageSize="8" Skin="Office2007" ShowStatusBar="True" OnItemDataBound="RadGrid1_ItemDataBound" >
         <MasterTableView DataSourceID="SqlDataSourceAudit" CommandItemDisplay="Top" ClientDataKeyNames="AuditEntryID">
             <CommandItemSettings ExportToPdfText="Export to Pdf" />
             <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
             </RowIndicatorColumn>
             <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
             </ExpandCollapseColumn>
             <Columns>
                <telerik:GridClientSelectColumn Visible="true" HeaderStyle-Width="35px" UniqueName="ClientSelectColumn" HeaderText="Edit" ButtonType="ImageButton" Text="Edit" ImageUrl="~/images/16/pen_16.png" />
                 <telerik:GridTemplateColumn HeaderText="Sort" UniqueName="Sort" FilterControlAltText="Filter Sort column" Display = "false">  
                  <ItemTemplate
                      <telerik:RadNumericTextBox ID="rnSort" runat="server" Width = "100%" DataType="System.Int32" MinValue="0">
                          <NumberFormat DecimalDigits="0" />
                      </telerik:RadNumericTextBox>
                  </ItemTemplate>
                     <HeaderStyle Width="40px" />
                </telerik:GridTemplateColumn>
                 <telerik:GridTemplateColumn HeaderText="Building" UniqueName="Building" FilterControlAltText="Filter Building column">  
                  <ItemTemplate>
                      <telerik:RadComboBox ID="rcbBuilding" runat="server" AllowCustomText="True" Filter="Contains" Width="100%">
                      </telerik:RadComboBox>
                  </ItemTemplate
                     <HeaderStyle Width="100px" />
                </telerik:GridTemplateColumn>
                 <telerik:GridTemplateColumn HeaderText="Area" UniqueName="Area" FilterControlAltText="Filter Area column">  
                  <ItemTemplate
                      <telerik:RadTextBox ID="rtbRoom" runat="server" Width="100%" ToolTip="The area or room in the building">
                      </telerik:RadTextBox>
                  </ItemTemplate
                     <HeaderStyle Width="100px" />
                </telerik:GridTemplateColumn>
                  
                <telerik:GridButtonColumn ConfirmText="Delete this audit entry?" ConfirmDialogType="RadWindow"
                  ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                  UniqueName="DeleteColumn" ImageUrl="~/images/16/remove_16.png" FilterControlAltText="Filter DeleteColumn column">
                  <ItemStyle HorizontalAlign="Center"/>
                  <HeaderStyle Width="25px" />
                </telerik:GridButtonColumn>
             </Columns>
             <EditFormSettings>
                 <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                 </EditColumn>
             </EditFormSettings>
             <CommandItemTemplate>
                 <table>
                  <tr>
                    <td align="left">
                     <asp:ImageButton ID="btnAdd"
                       CommandName="Insert" Runat="server" ImageUrl = "~/images/16/add_16.png"
                       tooltip="Add new audit line" ></asp:ImageButton>
                     <asp:ImageButton ID="btnSave"
                      CommandName="Save" Runat="server" ImageUrl = "~/images/16/ok_16.png"
                      tooltip="Save all grid changes"></asp:ImageButton>
                    </td>
                    <td align="right">
                     <asp:ImageButton ID="btnRefresh"
                      CommandName="Cancel" Runat="server" ImageUrl="~/images/16/refresh_16.png"
                      tooltip="Refresh grid"></asp:ImageButton>
                    </td>
                  </tr>
                 </table>
            </CommandItemTemplate>
         </MasterTableView>
         <FilterMenu EnableImageSprites="False">
         </FilterMenu>
         <ClientSettings>
             <Selecting AllowRowSelect="True" />
             <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
             </Scrolling>
             <Resizing AllowColumnResize="True" />
             <ClientEvents OnRowSelected="RadGrid1_ItemSelected" OnCommand="RadGrid1_Command" OnRowDataBound="RadGrid1_RowDataBound" />
         </ClientSettings>
         <PagerStyle Mode="Slider" />
         <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Office2007">
         </HeaderContextMenu>
     </telerik:RadGrid>
Brett
Top achievements
Rank 1
 answered on 14 Jul 2011
6 answers
229 views
Hi,
I am getting other error as "Web.config missing registration."
I followed every instruction on this link  http://www.telerik.com/support/kb/aspnet-ajax/editor/error-web-config-registration-missing-the-telerik-dialogs-require-a-httphandler-registration-in-the-web-config-file.aspx
but no success. pls guide.
Thanks
Amruta
Amruta
Top achievements
Rank 1
 answered on 14 Jul 2011
4 answers
150 views
Hi,

in our project we have problem with grid width: on page load it's ok, here's piece of markup from page source:
<div tabIndex="0" class="RadGrid RadGrid_GreenSF FullWidth" id="ctl00_cphMain_tc1_ctl00_contentArea_ctl00_ctl01_gridClient" _events="[object Object]" control="[object Object]" EmptyDataText="No data" CommandItemDisplay="Top" jQuery1605439695548107272="158">

but after postback it looks like this:

<div tabIndex="0" class="RadGrid RadGrid_GreenSF FullWidth" id="ctl00_cphMain_tc1_ctl00_contentArea_ctl00_ctl01_gridClient" style="width: 682px;" _events="[object Object]" control="[object Object]" EmptyDataText="No data" CommandItemDisplay="Top" jQuery1608745933755360553="158">

I have no idea where this inline style came from, I have not set width for the grid.

As a result, grid occupies not whole width, as FullWidth (width: 100%) prescribes, but instead some part of the page :(

What could be wrong here?

p.s. There is nothing especial with postback, the only note: postback happens from parent page and the grid is situated in iframe page.
Alexander
Top achievements
Rank 1
 answered on 14 Jul 2011
3 answers
88 views
Hi All,

  I have few buttons on my pager template. The buttons disappear when the last record is left. I want  those buttons to appear if I am on the last record. below is my code. i want the Update Record Button and Save Record button on the pager item. How can i achieve this.
<PagerTemplate>
                <table border="0" cellpadding="0" cellspacing="0" style="height: 20px" width="540px">
       <tr >
         <td style="width:10%" >
          
           <asp:ImageButton ID="btnFirst" runat="server" ImageUrl="~/images/PagingFirst.gif" AlternateText="First" CommandName="Page" CommandArgument="First" />
         </td>
         <td style="width:10%">
        
           <asp:ImageButton ID="btnPrev" runat="server" ImageUrl="~/images/PagingPrev.gif" CommandName="Page" CommandArgument="Prev" />
         </td>
         <td style="width:10%">
    
           <asp:ImageButton ID="imgNext" runat="server" ImageUrl="~/images/PagingNext.gif" CommandName="Page" CommandArgument="Next" />
         </td>
         <td style="width:10%">
         
           <asp:ImageButton ID="imgLast" runat="server" ImageUrl="~/images/PagingLast.gif" CommandName="Page" CommandArgument="Last" />
         </td>
              <td style="width:35%"  >
               <asp:Button ID="Btn_UpdateRecord" runat="server" Text="Update Record" OnClick="Btn_UpdateRecord_Click" />
           </td>
                <td  >
               <asp:Button ID="Btn_FinalizeRecord" runat="server" Text="Save Record" OnClick="Btn_FinalizeRecord_Click" />
           </td>
       </tr>
     </table>
   </PagerTemplate>

Thanks for all the help.
Anjali
Top achievements
Rank 1
 answered on 14 Jul 2011
5 answers
329 views
I'm trying to develop an grid that is entirely dynamic - the columns are defined in the code-behind, as a result of a database query.

In insert/edit, some of the columns need to be displayed as dropdown lists - and for some of them the contents of the list are the result of a database query, and for others the content is a fixed set of strings.

Right now, I'm working with the latter, thinking it'd be simpler.  Populating the dropdowns from the database I'll worry about after I get the fixed dropdowns working.

You have a note one one of your pages to the effect that the GridDropDownColumn isn't really intended for use with custom object collections, and that I should consider using a template column.  My understanding is that template columns, when added in code-behind, need to be added in Page_Init() - which would seem to rule them out, as I won't know what columns need to be added that early in the page life-cycle.  So GridDropDownColumn is what I have to work with.

In Page_Load, when !IsPostBack, I use the following code to create the column:

GridDropDownColumn col = new GridDropDownColumn(); 
this.grdRecords.MasterTableView.Columns.Add(col); 
col.DataField = "foobar"
col.UniqueName = "foobar";


And then in OnItemDataBound, I populate the dropdown with:
if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode) 
   GridEditableItem editedItem = e.Item as GridEditableItem; 
   GridEditManager editMan = editedItem.EditManager; 
 
   GridDropDownListColumnEditor editor =  
      editMan.GetColumnEditor("foobar"as GridDropDownListColumnEditor; 
 
   editor.DataSource = new object[] { "FOO""BAR" }; 
   editor.DataBind(); 
}

When I display the grid, the foobar column is blank, though the "FOO" and "BAR" choices show up in the dropdown during edit.

I know the "foobar" DataField is correct, because when I use a GridBoundColumn instead of a GridDropDownColumn, the proper value displays in the grid.  (Though, of course, in the edit form I get a textbox, instead of a dropdown.)

I'm clearly missing something.  What?
Richard
Top achievements
Rank 2
 answered on 14 Jul 2011
2 answers
86 views
Hi,
I am trying to manipulate some controls of a RotatorItem in the ItemDataBound event. However, the e.Item.DataItem seems to be of type XmlDataSourceNodeDescriptor, with which I can't do much since it's a sealed class. I can see all my data there while debugging, but cannot access them. Any idea how? Fo example, I have a simple xml file like this:
<Images>
  <Image>
    <ImageUrl>PICT3345.jpg</ImageUrl>
  </Image>
  <Image>
    <ImageUrl>PICT4357.jpg</ImageUrl>
  </Image>
  <Image>
    <ImageUrl>PICT4479.jpg</ImageUrl>
  </Image>
  <Image>
    <ImageUrl>PICT5344.jpg</ImageUrl>
  </Image>
  <Image>
    <ImageUrl>PICT6294.jpg</ImageUrl>
  </Image>
  <Image>
    <ImageUrl>PICT6356.jpg</ImageUrl>
  </Image>
  <Image>
    <ImageUrl>PICT6898.jpg</ImageUrl>
  </Image>
  <Image>
    <ImageUrl>PICT7276.jpg</ImageUrl>
  </Image>
</Images>

(Obviously) I want to get to the InnerText of ImageUrl but I cannot.

Any help is greatly appreciated!

viktor



Viktor Takacs
Top achievements
Rank 2
 answered on 14 Jul 2011
1 answer
84 views

How can I set the radFilter culture dynamically?

I have radFilter.Main.de-DE.resx along with radFilter.Main.resx

 

But no matter what the culture of the page, it will not read the radFilter.Main.de-DE.resx file unless I explicitly

Set the properties to read that.
does that mean i have to have two web sites - one in english and one in german just to get the filter to read a different resx file?
I tag the page here. i've even got my browser set to german.

 

<%

 

@ Page Language="C#" MasterPageFile="~/NOVDarkBlue.Master" AutoEventWireup="true"

 

 

 

 

 

 

 

CodeBehind="WorkOrdersConsole.aspx.cs" Inherits="NOV.GOLD.WebApp.WorkOrders.WorkOrdersConsole" Culture="auto:en-US" UICulture="auto" %>

and i use a method to set the page culture

 

 

 

protected void InitialzeCulture()

 

{

 

 

string myLang = txtLang.Value;//this is set to de-DE

 

 

 

Thread.CurrentThread.CurrentUICulture = new CultureInfo(myLang);

 

 

 

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(myLang);

 

}

rik butcher
Top achievements
Rank 1
 answered on 14 Jul 2011
2 answers
57 views
Hi

Since upgrading to IE8.0.7600 I'm struggling with this stylesheet and it's affect on the RADGRID in IE8. The RADGRID has 2 Buttons on a row which can no longer be clicked, also when clicking to expand the Details table now throws a Javascript error.

The rogue stylesheet class is as follows, it's the width: 948px which seems to be causing the proble, if this is removed the page looks awful because everything is moved but the Buttons and details table work fine. I've tried inserting various z-index entries but without success. 

#container

 

 

 

{

 

 

background: #fff none;

 

 

 

height: 100%;

 

 

 

height: auto !important;

 

 

 

margin: 0 auto -100px;

 

 

 

min-height: 100%;

 

 

 

padding: 0;

 

 

 

text-align: left;

 

 

 

width: 948px;

 

}

 

Steve
Stevent
Top achievements
Rank 1
 answered on 14 Jul 2011
1 answer
94 views
I would like to scroll the tooltip according to the browser scroll, is there any property for that
Marin Bratanov
Telerik team
 answered on 14 Jul 2011
1 answer
163 views
I have a page that has RadToolTips on it.  They are never named the same and their number varies.  I can't seem to find a way to access them from javascript on page load because they seem to be hidden.  I need a collection of all the RadToolTips when the page is ready so I can determine their targetcontrolid's and bind onclick events to the target controls so that when a user clicks or hovers the target control, the tooltip is shown.  Any ideas?
Marin Bratanov
Telerik team
 answered on 14 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?