Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
128 views
I am attempting to dynamically change the ColumnEditor of a RadGrid based on if the value for that row is a TimeDate value or not.  As it stands right now, I am doing this in the OnEditCommand event by getting the value stored, checking if it can be parsed as a Date time, then either assigning the ColumnEditor to a custom TimePickerEditor or a custom TextColumnEditor.  This meaning that different rows can have different editors.

The issue is that when I switch from on row that has a timepicker to a row that has a texteditor, the viewstate is no longer valid and an exception is raised.  If I set EnableViewState to false, I cannot find a way to access those controls to get the new selected values from them.

At this point I am running in circles, any help or instruction on the proper way to adjust the columneditor per row would be appreciated.

Thanks,  Tyler
Tsvetoslav
Telerik team
 answered on 06 Jul 2010
3 answers
308 views
I have a RadGrid (I post the ASPX code below) and I want a different behavior in Edit/insert: when I enter in Edit mode I want AziendaRadCombobox to be disabled. Instead when I enter in Insert mode I want it Enabled. EditItemTemplate seems not to distinguish between edit and insert. Is there a simple way? Can you provide me a solution?

Thanks.

<telerik:RadGrid ID="RadGridAziendeForUser" runat="server" DataSourceID="ObjectDataSourceAziendeUtente" 
                EnableEmbeddedSkins="False" GridLines="None" Skin="MachinaWeb" AllowAutomaticUpdates="True" 
                AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowMultiRowSelection="True" 
                OnItemCommand="RadGridAziendeForUser_ItemCommand" OnItemDataBound="RadGridAziendeForUser_ItemDataBound" 
                AllowPaging="True" PageSize="5">  
                <ClientSettings EnablePostBackOnRowClick="True">  
                    <Selecting AllowRowSelect="True" /> 
                    <Scrolling EnableVirtualScrollPaging="True" ScrollHeight="200px" /> 
                </ClientSettings> 
                <MasterTableView AutoGenerateColumns="False" DataSourceID="ObjectDataSourceAziendeUtente" 
                    EditMode="InPlace" CommandItemDisplay="Top" DataKeyNames="IdUtente,IdAzienda" 
                    > 
                    <CommandItemTemplate> 
                        <div style="float: left;">  
                            <asp:LinkButton Text="Nuova Azienda" ID="Insert" runat="server" CommandName="InitInsert" /> 
                        </div> 
                    </CommandItemTemplate> 
                    <Columns> 
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" CancelImageUrl="~/Images/ImagesGrid/Cancel.gif" 
                            EditImageUrl="~/Images/ImagesGrid/Edit.gif" UpdateImageUrl="~/Images/ImagesGrid/Update.gif" 
                            InsertImageUrl="~/Images/ImagesGrid/Update.gif" UniqueName="EditCommandColumn" ItemStyle-Width="40px">  
                            <ItemStyle Width="40px" /> 
                        </telerik:GridEditCommandColumn> 
                        <telerik:GridBoundColumn DataField="IdUtente" DataType="System.Int64" HeaderText="IdUtente" 
                            ReadOnly="True" SortExpression="IdUtente" UniqueName="IdUtente" Visible="false">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="IdUtenteAsp" HeaderText="IdUtenteAsp" SortExpression="IdUtenteAsp" 
                            UniqueName="IdUtenteAsp" DataType="System.Guid" Visible="false">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="UserName" HeaderText="UserName" ReadOnly="True" 
                            SortExpression="UserName" UniqueName="UserName" Visible="false">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="IdCultura" DataType="System.Int64" HeaderText="IdCultura" 
                            ReadOnly="True" SortExpression="IdCultura" UniqueName="IdCultura" Visible="false">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label46" runat="server" Text="Azienda" Width="130px"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="AziendaRadComboBox" runat="server" DataSourceID="ObjectDataSourceAzienda" 
                                    DataTextField="NomeAzienda" DataValueField="IdAzienda" SelectedValue='<%# Bind("IdAzienda") %>' 
                                    Width="120px" Enabled="false" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label47" runat="server" Width="120px" Text='<%# Bind("Azienda") %>'></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label48" runat="server" Text="Cultura" Width="80px"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="CulturaRadComboBox" runat="server" DataSourceID="ObjectDataSourceCultura" 
                                    DataTextField="Cultura" DataValueField="IdCultura" SelectedValue='<%# Bind("IdCultura") %>' 
                                    Width="70px" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label50" runat="server" Width="70px" Text='<%# Bind("Cultura") %>'></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label49" runat="server" Text="Gruppo" Width="130px"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="GruppoRadComboBox" runat="server" DataSourceID="ObjectDataSourceGruppoUtente" 
                                    DataTextField="Nome" DataValueField="IdGruppoUtente" SelectedValue='<%# Bind("IdGruppo") %>' 
                                    Width="120px" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label51" runat="server" Text='<%# Bind("Gruppo") %>' Width="120px"></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label52" runat="server" Text="Stabilimento" Width="130px"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="StabilimentoRadComboBox" runat="server" DataSourceID="ObjectDataSourceStabilimento" 
                                    DataTextField="Denominazione" DataValueField="IdStabilimento" SelectedValue='<%# Bind("IdStabilimento") %>' 
                                    Width="120px" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label53" runat="server" Text='<%# Bind("Stabilimento") %>' Width="120px"></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label54" runat="server" Text="Reparto" Width="130px"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="RepartoRadComboBox" runat="server" DataSourceID="ObjectDataSourceReparto" 
                                    DataTextField="Reparto" DataValueField="IdReparto" SelectedValue='<%# Bind("IdReparto") %>' 
                                    Width="120px" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label55" runat="server" Text='<%# Bind("Settore") %>' Width="120px"></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridButtonColumn CommandName="Delete" ImageUrl="~/Images/ImagesGrid/Delete.gif" 
                            UniqueName="DeleteColumn" ConfirmText="Do you really want to delete the selected row?" 
                            ButtonType="ImageButton" /> 
                    </Columns> 
                    <EditFormSettings> 
                        <EditColumn> 
                        </EditColumn> 
                    </EditFormSettings> 
                </MasterTableView> 
                <FilterMenu EnableEmbeddedSkins="False">  
                </FilterMenu> 
                <HeaderContextMenu EnableEmbeddedSkins="False">  
                </HeaderContextMenu> 
            </telerik:RadGrid> 
Princy
Top achievements
Rank 2
 answered on 06 Jul 2010
2 answers
107 views
Hi Telerik,

I cannot expand node when I set Enabled = false in ComboBox

Here is my Code

<script type="text/javascript" language="javascript"> 
            function nodeClicking(sender, args) { 
                var comboBox = $find("<%= RadComboBox1.ClientID %>"); 
 
                var node = args.get_node() 
 
                comboBox.set_text(node.get_text()); 
 
                comboBox.trackChanges(); 
                comboBox.get_items().getItem(0).set_value(node.get_value()); 
                comboBox.commitChanges(); 
 
                comboBox.hideDropDown(); 
            } 
 
            function OnClientDropDownOpenedHandler(sender, eventArgs) { 
                var tree = sender.get_items().getItem(0).findControl("RadTreeView1"); 
                var selectedNode = tree.get_selectedNode(); 
                if (selectedNode) { 
                    selectedNode.scrollIntoView(); 
                } 
            } 
        </script> 


    <form id="form1" runat="server"> 
    <div> 
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
        <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="100%" OnClientDropDownOpened="OnClientDropDownOpenedHandler"> 
            <Items> 
                <telerik:RadComboBoxItem Text="None" Value="0" /> 
            </Items> 
            <ItemTemplate> 
                <telerik:RadTreeView ID="RadTreeView1" runat="server" OnClientNodeClicking="nodeClicking"> 
                    <Nodes> 
                        <telerik:RadTreeNode runat="server" Text="Africa" Expanded="true"> 
                            <Nodes> 
                                <telerik:RadTreeNode runat="server" Text="Egypt" Enabled="false"> 
                                    <Nodes> 
                                        <telerik:RadTreeNode runat="server" Text="Cairo"> 
                                        </telerik:RadTreeNode> 
                                    </Nodes> 
                                </telerik:RadTreeNode> 
                                <telerik:RadTreeNode runat="server" Text="South Africa"> 
                                    <Nodes> 
                                        <telerik:RadTreeNode runat="server" Text="Cape Town"> 
                                        </telerik:RadTreeNode> 
                                    </Nodes> 
                                </telerik:RadTreeNode> 
                                <telerik:RadTreeNode runat="server" Text="Kenya"> 
                                    <Nodes> 
                                        <telerik:RadTreeNode runat="server" Text="Nairobi" Value="1999"> 
                                        </telerik:RadTreeNode> 
                                    </Nodes> 
                                </telerik:RadTreeNode> 
                            </Nodes> 
                        </telerik:RadTreeNode> 
                    </Nodes> 
                </telerik:RadTreeView> 
            </ItemTemplate> 
        </telerik:RadComboBox> 
     
    </div> 
    </form> 

Please help me to expand node when disabled
VnDevil
Top achievements
Rank 2
 answered on 05 Jul 2010
4 answers
170 views
My application looks like this :

There is a radSplitter with two panes, and the bottom pane contains a radEditor and is collasped at startup. I have a radAjaxManager that update the radEditor, and this javascript function :
function scriptError() { 
            var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); 
            ajaxManager.ajaxRequest("x"); 
        } 

Now the ajax request looks like this :
If e.Argument.Equals("x") Then 
    RadEditor1.Content = "<br /><p>Some Text...</p>" 
End If 

It's working fine as a web application in internet explorer, but I'm rendering this page in a webbrowser control of a winForm application and I'm calling the script on a button click :
WebBrowser1.Document.InvokeScript("scriptError", New Object() {}) 

Up to this, no error. It is when I close the application that a strange javascript error appear ("_events is null or not an object ......"). The error only appear when the bottom pane is collasped???

I'm quite new to web programming so it is possible that there is a logic error in my programming, but have totally no idea why it is causing this.

Thanks
Sébastien
Top achievements
Rank 1
 answered on 05 Jul 2010
1 answer
75 views
I'm having a problem when exporting my grid.  All the styles are being lost.  I am using the out of the box WebBlue skin and in the page i can see that the styles are being set in the grid.  However, everytime I export to Excel, Word, etc all the styles are lost.  Is there a workaround or a property I need to set..?
Daniel
Telerik team
 answered on 05 Jul 2010
1 answer
128 views
Hi,

        I am using a radwindow with modal background. I have a requirement to make the window float when the page is scrolled. I referred the scripts from this link,
http://www.telerik.com/community/code-library/aspnet-ajax/window/floating-r-a-d-window-on-page-scroll-window-stays-visible-during-scrolling.aspx
Find below the style and scripts,

<head runat="server"> 
    <title>Untitled Page</title> 
    <style type="text/css"> 
    html, body, form 
    { 
      padding: 0px; 
      margin: 0px; 
      height: 100%; 
      width: 100%; 
    } 
     
    .RadWindow 
    { 
        position: fixed !important; 
 
    } 
    </style> 
</head> 
<script type="text/javascript"> 
            function GetSelectedWindow() 
            { 
                var oManager = GetRadWindowManager(); 
                return oManager.getActiveWindow();       
            } 
             
            function PositionWindow ()  
            { 
           
                var oWindow = GetSelectedWindow();   
                if (!oWindow) { 
                    return; 
                } 
                 
                var Y = document.body.clientHeight +  
                        document.body.scrollTop -  
                        oWindow.get_height(); 
                 
                var X = document.body.clientWidth +  
                        document.body.scrollLeft -  
                        oWindow.get_width(); 
 
                Y = (Y > 0) ? Y : 0; 
                X = (X > 0) ? X : 0;                     
                oWindow.moveTo(X, Y); 
            } 
 
            function InitWindow ()  
            { 
                setTimeout(function() 
                { 
                    var oWindow = GetRadWindowManager().getActiveWindow();   
                    if (!oWindow)  
                    { 
                        window.setTimeout('InitWindow()', 500); 
                    } 
 
               PositionWindow();}, 0); 
            } 

But the script is not working only in IE 6. This problem is because of the css property position : fixed. But when i tried removing, the scripts are not working. Please help with the code changes to make it work on all browsers including IE 6 mainly.

Regards,
Saravanan K
 

Svetlina Anati
Telerik team
 answered on 05 Jul 2010
3 answers
119 views
I want to customize the radEditor ColorPicker. I know how to add my own colors, but I would want to modify the number of colums it is showing (By default it seems to be 10)

Thank you again Telerik team!
Rumen
Telerik team
 answered on 05 Jul 2010
2 answers
166 views
Hi, I'm trying to use a combobox in a grid like in the exaple here: http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/comboingrid/defaultcs.aspx?product=grid

The only thing is, I would like to do some formatting etc. on the combobox, so I did:
                                <telerik:gridtemplatecolumn uniquename="IconID" datafield="IconID" headertext="Icon">
                                    <itemtemplate>
                                        <asp:image id="imgIcon" runat="server" />
                                    </itemtemplate>
                                    <edititemtemplate>
                                        <telerik:RadComboBox  
                                            ID="rcbIcon"
                                            runat="server" />
                                    </edititemtemplate>
                                </telerik:gridtemplatecolumn>

And then in the codebehind:

#Region "rgCategories_ItemDataBound"
        Protected Sub rgCategories_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgCategories.ItemDataBound
            If e.Item.ItemType = GridItemType.Item Or e.Item.ItemType = GridItemType.AlternatingItem Then
                Dim objCategoryInfo As CategoryInfo = CType(e.Item.DataItem, CategoryInfo)
                If objCategoryInfo.IconID <> -1 Then
                    _Icon = objCategoryInfo.IconID
                    Dim objIcon As MarkerInfo = lstMarkerInfo.Find(AddressOf FindIcon)
                    If Not objIcon Is Nothing Then
                        Dim imgIcon As System.Web.UI.WebControls.Image = CType(e.Item.FindControl("imgIcon"), System.Web.UI.WebControls.Image)
                        imgIcon.ImageUrl = objIcon.MarkerFilename
                    End If
                End If
            End If
            If e.Item.ItemType = GridItemType.EditItem Then
                Dim comboBox As RadComboBox = DirectCast(e.Item.FindControl("RCBIcon"), RadComboBox)
                comboBox.Items.Clear()
                Dim objMarkerInfo As MarkerInfo
                Dim itemtext As String

                For Each objMarkerInfo In lstMarkerInfo
                    itemtext = objMarkerInfo.MarkerFilename.Replace(".png", "")
                    itemtext = itemtext.Remove(0, itemtext.LastIndexOf("/") + 1)
                    Dim item As New RadComboBoxItem()
                    item.Text = itemtext
                    item.Value = objMarkerInfo.MarkerID
                    item.ImageUrl = objMarkerInfo.MarkerFilename
                    comboBox.Items.Add(item)
                Next

                Dim objCategoryInfo As CategoryInfo = CType(e.Item.DataItem, CategoryInfo)
                If objCategoryInfo.IconID <> -1 Then
                    If Not comboBox.FindItemByValue(objCategoryInfo.IconID) Is Nothing Then
                        comboBox.FindItemByValue(objCategoryInfo.IconID).Selected = True
                    End If
                End If
            End If
        End Sub
#End Region

However when I try to update, the IconId will always be 0 instead of the selected icon from the dropdown


Marnix Bouwman
Top achievements
Rank 2
 answered on 05 Jul 2010
2 answers
91 views
Hi there,

My users are uploading HTML content via a RadEditor control on their personal page.  (They will be pasting content from a source with the Editor in Design Mode rather than entering HTML directly.)  I would like to set the RadEditor control so that any links they include in their content automatically have a target="_blank" attribute inserted (if not already present), or do something equivalent so that on the resulting page the links will be opened in a new window/tab (rather than taking the viewer away from my web-site).  Any suggestions?

All advice gratefully received,

Ed Graham
Ed
Top achievements
Rank 1
 answered on 05 Jul 2010
1 answer
183 views
how can i create a custom RadGrid Filter?
in other words i have a gridview, and i want to create a custom Filter on a certian GridBoundColumn. i know that i should use this:

<

 

telerik:GridBoundColumn DataField="ID" HeaderText="ID"

 

 

<FilterTemplate>

 


</

 

FilterTemplate>

 

 

</telerik:GridBoundColumn>

but lets say i have a listbox inside the above filterTemplate. how can i add the FilterButton (that shows equalto,notequalto.... when clicked) so a user can choose an item from the listbox, and filters accordingly.

i have already seen this link:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filteringtemplatecolumns/defaultcs.aspx
but this link adds a dropdownlist to the GridBoundColumn Filtertemplate, but it filters when the selectedValue of the dropdownlist changes. what i need is the same filterButton that appears by default (that contains the filter criteria when selected)

 

Pavlina
Telerik team
 answered on 05 Jul 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?