Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
202 views
Hi -

I'm using VS 2008 and it's entity framework.  Is it possible to use the in-line editing (Grid / Automatic Operations) with entity framework?, like in the example: 
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx

I have been playing around with it and can't get anything to work but for poulating the grid and editing the field.  I have an edit and delete button and the CommandItemDisplay is set to "Top".  I need some assitance in order to get the insert working and the textbox in the correct spot.  I'm not sure if I need behind code or if my html page is not setup correctly. 

Here is my code block:

<%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Master.Master" AutoEventWireup="true" CodeBehind="RadGridInLineTest2.aspx.cs" Inherits="TelerikTest.Pages.RadGridInLineTest2" %> 
<%@ MasterType VirtualPath="~/Pages/Master.Master" %>   
<%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
 
  <asp:Panel ID="Panel2" runat="server" 
    style="z-index:1; position:absolute; top:100px; left: 0px;">  
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">  
      <ContentTemplate> 
        <div> 
          <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
              <telerik:AjaxSetting AjaxControlID="systemApplyOffsetRadGrid">  
                <UpdatedControls> 
                  <telerik:AjaxUpdatedControl ControlID="systemApplyOffsetRadGrid" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                  <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" /> 
                </UpdatedControls> 
              </telerik:AjaxSetting> 
            </AjaxSettings> 
          </telerik:RadAjaxManager> 
          <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> 
          <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"   
            style="z-index:1; position:absolute; top:9px; left:-30px;">  
            <div> 
                <telerik:RadGrid ID="systemApplyOffsetRadGrid" runat="server"   
                  GridLines="None"   
                  PageSize="5"   
                  Skin="WebBlue"   
                  AllowAutomaticInserts="true"   
                  AllowAutomaticUpdates="true" 
                  AllowAutomaticDeletes="true" 
                  DataSourceID="EntityDataSource1" 
                  style="z-index: 1; left: 150px; top:50px; position: absolute">  
                  <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID" TableLayout="Fixed" 
                    CommandItemDisplay="Top" Name="Master" ShowHeader="true" Caption="Apply Offset" Width="100%"   
                    CssClass="RadGrid" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true">  
                    <Columns> 
                      <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" 
                        EditImageUrl="../Images/Edit.gif" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center">  
                      </telerik:GridEditCommandColumn> 
                      <telerik:GridBoundColumn DataField="ID" DataType="System.Int32"   
                        HeaderText="ID" ReadOnly="True" SortExpression="ID"   
                        UniqueName="ID" HeaderStyle-Width="50px" ItemStyle-HorizontalAlign="Center"   
                        HeaderStyle-HorizontalAlign="Center">  
                      </telerik:GridBoundColumn> 
                      <telerik:GridBoundColumn DataField="Lookup_Value"   
                        HeaderText="Lookup Value" SortExpression="Lookup_Value"   
                        UniqueName="Lookup_Value" HeaderStyle-Width="150px" ColumnEditorID="GridTextBoxColumnEditor1">  
                      </telerik:GridBoundColumn> 
                      <telerik:GridButtonColumn ConfirmText="Delete this Applied Offset?" 
                        ImageUrl="../Images/Delete.gif" 
                        ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" 
                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" 
                        HeaderStyle-Width="40px" ItemStyle-HorizontalAlign="Center">  
                      </telerik:GridButtonColumn> 
                    </Columns> 
                    <EditFormSettings ColumnNumber="2" CaptionDataField="Lookup_Value">  
                      <FormTableItemStyle Wrap="false" /> 
                      <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="0" /> 
                      <FormTableStyle CellSpacing="0" CellPadding="0" /> 
                      <FormTableAlternatingItemStyle Wrap="false" /> 
                      <EditColumn ButtonType="ImageButton" InsertText="Insert Value" UpdateText="Update Value"   
                        UniqueName="EditCommandColumn1" CancelText="Cancel Edit"></EditColumn> 
                    </EditFormSettings> 
                  </MasterTableView> 
                  <ClientSettings ClientEvents-OnRowDblClick="RowDblClick"></ClientSettings> 
                </telerik:RadGrid> 
                <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="75px"></telerik:GridTextBoxColumnEditor> 
                <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager> 
                <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=AllDataModels" 
                  DefaultContainerName="AllDataModels" EntitySetName="lkup_ApplyOffset" EnableDelete="true" 
                  EnableInsert="true" EnableUpdate="true">  
                </asp:EntityDataSource> 
                <asp:CustomValidator ID="customValidator" runat="server" ErrorMessage="CustomValidator" 
                  style="z-index:1; position:absolute; top:52px; left:500px; height: 61px; width: 283px;"></asp:CustomValidator> 
            </div> 
          </telerik:RadAjaxPanel> 
        </div> 
      </ContentTemplate> 
    </asp:UpdatePanel> 
  </asp:Panel> 
  <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
      <script type="text/javascript">  
      function RowDblClick(sender, eventArgs)  
      {  
        sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());  
      }  
      </script> 
  </telerik:RadCodeBlock> 
</asp:Content> 

My goal is to be able to modify the Lookup_Value column within the grid itself (add/edit/delete) like the demo example.  I've attached a screen shot of the grid in editing mode.  The editing is done on another line than the record is shown in the grid and it is not what I would consider "In-Line". 

So, what I'd like help with is:
1. Get the Add New Record to work
2. Get the Deleting to work
3. Get the in-line to be in the correct spot, ...on the same row as the record.

Some assistance would be a big help. 
Thanks!!
wen
Rosen
Telerik team
 answered on 25 May 2010
5 answers
148 views
Hi there,

While there is a good reason for docks not to be resizable horizontally when docked could you tell what prevents implementing vertical resize? And is there any workaround to make docks resizable?

Thank you,
Valery.
Pero
Telerik team
 answered on 25 May 2010
1 answer
172 views
I am trying to use an existing UserControl(PrinterSettingsControl) as the PopUp EditForm for a RadGrid which is bound to a business object ( IList(Of ClientSidePrinterProperties)  ) and I need to set the value of a couple of properties on the user control to make it operate properly. Below is the code I have working on for editing an existing entry, but I can't figure out how to accomplish the same functionality for adding a new record, specifically finding the UserControl like the e.Item.FindControl() shown below. I have tried manipulating the ItemCreated, ItemDataBound and ItemCommand event handlers but just can't seem to find the control.

Any ideas?

 

 

    Private Sub printersGrid_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles printersGrid.ItemCreated  
 
        Debug.WriteLine("In ItemCreated")  
        Debug.Indent()  
        Debug.WriteLine("e.Item.ToString = " & e.Item.ToString)  
 
 
        Dim printerSettingsControl As PrinterSettingsControl  
 
        If TypeOf e.Item Is GridEditFormItem And e.Item.IsInEditMode Then 
 
            Dim clientSettings As ClientSidePrinterProperties  
 
            printerSettingsControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), PrinterSettingsControl)  
 
            If e.Item.OwnerTableView.IsItemInserted Then 
                Dim MyUserControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)  
            Else 
 
                clientSettings = DirectCast(e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("Settings"), ClientSidePrinterProperties)  
 
                printerSettingsControl.Options = printerSettingsControl.Option.ShowUpdateCancelButtons  
                printerSettingsControl.IsRaw = ViewState("IsRaw")  
                printerSettingsControl.Locked = ViewState("locked")  
                printerSettingsControl.PopulateControls(clientSettings)  
 
            End If 
 
        End If 
 
        'If TypeOf e.Item Is GridEditFormItem Then  
 
        '    Dim clientSettings As ClientSidePrinterProperties  
 
        '    If e.Item.IsInEditMode Then  
 
        '        clientSettings = DirectCast(e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("Settings"), ClientSidePrinterProperties)  
 
        '        printerSettingsControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), PrinterSettingsControl)  
 
        '        printerSettingsControl.Options = printerSettingsControl.Option.ShowUpdateCancelButtons  
        '        printerSettingsControl.IsRaw = ViewState("IsRaw")  
        '        printerSettingsControl.Locked = ViewState("locked")  
        '        printerSettingsControl.PopulateControls(clientSettings)  
 
        '    ElseIf e.Item.OwnerTableView.IsItemInserted Then  
 
        '        Debug.WriteLine("IsItemInserted")  
 
        '        printerSettingsControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), PrinterSettingsControl)  
 
        '        If printerSettingsControl IsNot Nothing Then  
 
        '            Debug.WriteLine(printerSettingsControl.ToString)  
 
        '        End If  
 
        '    End If  
 
        'End If  
 
        Debug.Unindent()  
 
    End Sub 'RadGrid1_ItemCreated  
 
 
    Private Sub printersGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles printersGrid.ItemDataBound  
 
        Debug.WriteLine("In ItemDataBound")  
        Debug.Indent()  
 
        Debug.WriteLine("e.Item.ToString = " & e.Item.ToString)  
 
        If TypeOf e.Item Is GridEditFormItem And e.Item.IsInEditMode Then 
 
            If e.Item.OwnerTableView.IsItemInserted Then 
                Dim MyUserControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)  
            Else 
                Dim MyUserControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)  
            End If 
 
        End If 
 
        Debug.Unindent()  
 
    End Sub 'RadGrid1_ItemDataBound  
 
 
    Private Sub printersGrid_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles printersGrid.ItemCommand  
 
        Debug.WriteLine("In ItemCommand")  
        Debug.Indent()  
        Debug.WriteLine("e.CommandName.ToString = " & e.CommandName.ToString)  
 
        If e.CommandName = RadGrid.InitInsertCommandName Then 
            e.Canceled = True 
 
            Dim newValues As New System.Collections.Specialized.ListDictionary  
 
            newValues("Settings") = ClientSidePrinterProperties.CreateDefault  
 
            e.Item.OwnerTableView.InsertItem(newValues)  
 
        End If 
 
        Debug.Unindent()  
 
    End Sub 

 

 

 

 

 

 

Veli
Telerik team
 answered on 25 May 2010
2 answers
82 views
Hello to all,

has anybody any idea, why this can happen:
when selecting an image and a bit of text and pasting it into another line of text, then the text before the pasted image is removed...
Have a look at this video, it explains pretty much the situation:
http://dl.dropbox.com/u/6956186/ErrorPasteImgAndTextInExistingText.avi


This only happens in Firefox, not in InternetExplorer.

We use DLL-Version: 2009.2.826.35

Mybe one of you ran in a similar problem...
Thanks in advance
Felix

Felix
Top achievements
Rank 2
 answered on 25 May 2010
6 answers
195 views
Hello,
I have two list boxes (radFullList and radList) which are linked together for AllowTransfer. Not that it matters but the first listbox is a list of employee names, the value is their employee number. The second listbox is for holding the employee's supervisors so when you move an items from radFullList to radList it maintains the same format, employee name and employee number in the value.

EmployeeEditView.ascx
<telerik:RadListBox ID="radFullList" runat="server" AllowTransfer="True"  
    AllowTransferOnDoubleClick="true" EnableDragAndDrop="true" TransferToID="radList"  
    DataKeyField="GUID" DataSortField="EmployeeName" DataSourceID="LinqDS4"  
    DataTextField="EmployeeName" DataValueField="EmployeeNumber" Height="200px"  
    Width="200px"> 
    <ButtonSettings ReorderButtons="Common"></ButtonSettings> 
</telerik:RadListBox> 
<telerik:radlistbox ID="radList" runat="server" Height="200px" Width="200px"  
    AllowReorder="true" AllowDelete="true" /> 
<asp:LinqDataSource ID="LinqDS4" runat="server"  
    ContextTypeName="Modules.EmployeeManagement.EmployeeManagementDataContext"  
    TableName="tblEmployees" OrderBy="EmployeeName" > 
</asp:LinqDataSource> 

I have this wired up to a Save button in my Sitefinity Module. 

EmployeeEditView.ascx.vb
Dim sb As New StringBuilder() 
Dim db = New Modules.EmployeeManagement.EmployeeManagementDataContext 
Dim employee = (From t In db.tblEmployees Where t.GUID = Me.DataItemId Select t).Single 
employee.EmployeeName= txtName.Text 
... 
employee.UserGroup = radUserGroup.SelectedValue 
For Each item As RadListBoxItem In radList.Items 
    sb.Append(item.Value.ToString & "|") 
Next 
employee.SupervisorNumber = Left(sb.ToString, 59) 
db.SubmitChanges() 
Response.Redirect(CreateHostViewCommand("EmployeeEditView", DataItemId.ToString, Nothing)) 

So as you can see all I am doing is a simple write from the form.

Scenario: This code works perfectly if the second listbox (radList) is empty. You add 1 or 2 employees to the second list box, hit save and the results written to the database are accurate.

If you go back in to this employee's account, you will see everything is correct. Instead of exiting, if you simply hit Save again all the entries in the second listbox, radList, are duplicated. Both times the same code is used since I am "Updating" the employee both times.

As a test to get screens for this post I edited an employee who has no supervisors. Which you can see in screenshot "001.png". Screenshot "002.png" is after adding two accounts as supervisors. The screenshot is taken after Save is clicked which means not only did it save to the database correctly, but it was loaded into the listbox correctly as well. Now in screenshot "003.png" is after clicking the Save button once more without performing any work with the listboxes. As you can see the two entries are repeated.

As far as I can tell from looking up documentation associated with RadListBox I am using the correct code to cycle through items. "For Each item As RadListBoxItem In radList.Items" Any help you can offer would be greatly appreciated.
Genady Sergeev
Telerik team
 answered on 25 May 2010
7 answers
349 views
I have two tables. Disciplines and DisciplineReveiwers

I assign users (reviewers) to a discipline. The source listbox lists the disciplines and the destination listbox lists the DisciplineReviewers. Populating the boxes and transferring items works well. THe problem is that it does not update the database when doing so. Can some one take a look and tell me what I'm doing wrong? I don't want to update the Disciplines table, just the DisciplinesReviwer table.

 <ul class="listbox-list"> 
                    <li class="listbox-item"> 
                         <telerik:RadListBox ID="radListDisciplines" runat="server" AllowTransfer="True" 
                            AutoPostBackOnDelete="True" AutoPostBackOnTransfer="True" DataSourceID="sqlListDisciplines" 
                            TransferToID="radListAssigned" DataTextField="DisciplineName" DataValueField="DisciplineId" Width="300px" DataKeyField="DisciplineId"> 
                         </telerik:RadListBox> 
                    </li> 
                    <li class="listbox-item"> 
                        <telerik:RadListBox ID="radListAssigned" runat="server"  
                            DataSourceID="sqlReviewersDisciplines" 
                             DataTextField="DisciplineName" DataValueField="DisciplineId" AllowDelete="True"  
                             AutoPostBack="True" AutoPostBackOnDelete="True" AutoPostBackOnTransfer="True"  
                             DataKeyField="DisciplineReviewerId" TransferToID="radListDisciplines" Width="300px"> 
                        </telerik:RadListBox> 
                    </li> 
                 </ul> 
<div style="clear:both;"></div>                   
                 
                <asp:SqlDataSource ID="sqlListDisciplines" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" 
                    SelectCommand="Dej_DisciplineList" SelectCommandType="StoredProcedure"> 
                    <SelectParameters> 
                        <asp:ControlParameter ControlID="hidOrgId" Name="OrgId" PropertyName="Value" Type="Int32" /> 
                    </SelectParameters> 
                </asp:SqlDataSource> 
                 
                <asp:SqlDataSource ID="sqlReviewersDisciplines" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" 
                    SelectCommand="Dej_ListDisciplineReviewerByReviewer"  
                    SelectCommandType="StoredProcedure"  
                    DeleteCommand="Dej_DisciplineReviewerDelete"  
                    DeleteCommandType="StoredProcedure"  
                    InsertCommand="Dej_DisciplineReviewerAdd"  
                    InsertCommandType="StoredProcedure"> 
                    <SelectParameters> 
                        <asp:ControlParameter ControlID="hidReviewerId" Name="UserId" PropertyName="Value" 
                            Type="Int32" /> 
                    </SelectParameters> 
                    <DeleteParameters> 
                        <asp:Parameter Name="DisciplineReviewerId" Type="Int32" /> 
                    </DeleteParameters> 
                    <InsertParameters> 
                        <asp:Parameter Name="DisciplineId" Type="Int32" /> 
                        <asp:Parameter Name="ReviewerId" Type="Int32" /> 
                    </InsertParameters> 
                </asp:SqlDataSource> 

Genady Sergeev
Telerik team
 answered on 25 May 2010
1 answer
41 views
Hi,
I have few issues listed below:-

1) I am trying to Group the Columns which i have made it as ItemTemplates.
In this Case i am not able to Group the Columns accordingly. Please help in this case.

2) FileUpload in RADAjaxmanager -  I am trying to use a Fileupload in RADAjax manager - But i am not able to use the same.

3) I am trying to Change the Colour and Hitting Enter to Filter the RADGrid Columns but i am not able to do this.

Main Conditions is I am Dynamically Generating the Columns from the Source.

Please help me in this Regards.

Thanks and Regards,
Sarvesh Jain.
Yavor
Telerik team
 answered on 25 May 2010
1 answer
90 views
I posted a question before and got great help
http://www.telerik.com/community/forums/aspnet-ajax/window/how-to-get-the-current-position-of-radwindow.aspx


the method in telerik's static client library works very well
var bounds = $telerik.getBounds(oWnd.get_popupElement());

There is the way how I use this method as following.

In main page which contains the radwindowmanager, I added an radwindow "A" under the radwindowmanager. After I opened the radwindow "A", I tried to open another radwindow "B" from radwindow "A" by using the code below.

function ShowWindow() {

               var found = false;

               var allWindows = GetWindowManager().get_windows
               for (var i = 0; i < allWindows.length; i++) {

                   var oWnd = allWindows[i];

                   var bounds = $telerik.getBounds(oWnd.get_popupElement());
           
        if (oWnd._title == "B" ) {

                        found = true;

                       break;

                   }

               }

......
}

in web.config.

<location path="Telerik.Web.UI.WebResource.axd">

    <system.web>

      <authorization>

        <allow users="*" />

      </authorization>

    </system.web>

  </location>


However, recently I always got the error message as below

Message: 'window' is null or not an object

Line: 124

Char: 54

Code: 0

URI: http://srfwpc12.????.com/????/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a8f393b2b-3315-402f-b504-cd6d2db001f6%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-US%3a1c53f111-a7b9-466f-ae26-3bd14c91dc5a%3a16e4e7cd%3af7645509%3a22a6274a%3a24ee1bba%3a1e771326%3a2bef5fcc


I was wondering whether the new probelm is related with some IIS setting or other permission issue? I

Thanks a lot.

 
yao wang
Top achievements
Rank 1
 answered on 25 May 2010
4 answers
156 views
The EmptyMessage shows up fine on initial page load.  I'm setting AllowCustomText="True" and Filter="Contains".  I can select a value and submit it.  But on page postback the selected item shows up in the combobox instead of the EmptyMessage text.

Help!  Thanks.

Here's a link to the example: RadComboBox bug



Matt
Top achievements
Rank 1
 answered on 24 May 2010
2 answers
188 views
For the FileExplorer control, is it possible to hid the Overwrite Files checkbox in the upload window?
Bob van der Zinch
Top achievements
Rank 2
 answered on 24 May 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?