Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
146 views
hi all,

i have a custom validator for a RadUpload control in the grid. i want the validator to validate empty text only on insert not on update, on update it's not required to upload a file but if the user selected one it should get validated.

i have put this code in ItemDataBound
    Private Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound  
        If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then 
            Dim item As GridEditableItem = CType(e.Item, GridEditableItem)  
            Dim imageValidator As CustomValidator = CType(item.FindControl("CustomValidator2"), CustomValidator)  
            If (item.OwnerTableView.IsItemInserted) Then 
                imageValidator.ValidateEmptyText = True 
            Else 
                imageValidator.ValidateEmptyText = False 
            End If 
        End If 
    End Sub 

but it didn't work bcoz the ClientValidationFunction still validating empty text in both cases. So i tried to modify this function to check if the item is in edit or insert mode using get_isItemInserted, but sth is wrong and i coudn't fix it. Here is my code
function validateImageType(source, e)   
{  
    e.IsValid=false;  
 
    var upload=$find(source.parentNode.getElementsByTagName('div')[0].id);            
    var inputs=upload.getFileInputs();  
      
    if (e.get_isItemInserted==true)  
    {  
        for (var i = 0; i < inputs.length; i++)   
        {  
            //check for empty string or invalid extension  
            if (inputs[i].value != "" && upload.isExtensionValid(inputs[i].value))   
            {  
                e.IsValid=true;  
                break;  
            }  
        }              
    }              
    else 
    {  
        if (inputs.length>0)  
        {  
            for (var i = 0; i < inputs.length; i++)   
            {  
                //check for invalid extension only  
                if (upload.isExtensionValid(inputs[i].value))   
                {  
                    e.IsValid=true;  
                    break;  
                }  
            }                    
        }  
        else 
        {  
            e.IsValid=true;  
        }  
    }  
}       

And here is my column if nedded
            <telerik:GridTemplateColumn HeaderText="Image" SortExpression="image" UniqueName="image" AutoPostBackOnFilter="true" DataField="image">  
                <ItemTemplate> 
                    <img src='/Files/PhotoGallery/<%# Eval("image") %>' width="100" height="100" /> 
                </ItemTemplate> 
                <EditItemTemplate> 
                    <telerik:RadUpload ID="RadUpload1" runat="server" AllowedFileExtensions=".jpg,.jpeg" ControlObjectsVisibility="None"></telerik:RadUpload> 
                    <asp:CustomValidator ID="CustomValidator2" runat="server" ErrorMessage="Allowed file extensions are .jpg, .jpeg" ClientValidationFunction="validateImageType" Display="Dynamic"></asp:CustomValidator> 
                </EditItemTemplate> 
            </telerik:GridTemplateColumn>     

Any ideas plzzz..??

thnx in advance
FreshOne
Top achievements
Rank 1
 answered on 08 Feb 2010
1 answer
95 views
I fill my Grid in my code behind but when the page posts back my grid desapears....

Is the same site I'm building here:

Gilberto Anino
Top achievements
Rank 1
 answered on 08 Feb 2010
2 answers
298 views

I have a repeater that contains a Telerik RadComboBox:

<asp:Repeater ID="rpt" runat="server">
   
<ItemTemplate>
       
<telerik:RadComboBox ID="rcb" runat="server" EnableLoadOnDemand="true"  
             
AllowCustomText="true" ItemRequestTimeout="1000"
             
NumberOfItems="10" MarkFirstMatch="false">
       
</telerik:RadComboBox>
   
</ItemTemplate>
</asp:Repeater>

In the ItemDataBound event of the Repeater, I am wiring up the ItemsRequested event like this:

private void rpt_ItemDataBound(object sender, RepeaterItemEventArgs e) {
   
RadComboBox rcb = (RadComboBox)e.Item.FindControl("rcb");
    rcb
.ItemsRequested += rcb_ItemsRequested;
}
private void rcb_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) {
   
// Database call to load items occurs here.
   
// As configured, this method is never called.
}

Currently, the server-side rcb_ItemsRequested method is never called. I suspect that wiring the ItemsRequested event in the ItemDataBound is problematic, but the problem may lie elsewhere.

Any ideas on how to use the Telerik RadComboBox within a repeater properly? I also tried wiring the event in the markup, but that did not help either. I am using the latest version of the ASP.NET AJAX Rad Controls.

----------

I posted this question at stackoverflow:

http://stackoverflow.com/questions/2209503/using-telerik-radcombobox-within-a-repeater

Lenny_shp
Top achievements
Rank 2
 answered on 08 Feb 2010
6 answers
265 views
Hello,

Before I purchase the controls, I make a small check if they support right to left.

I'm having a problem with RadGrid, in my MasterPage I must define the body direction to "RTL":
<body Direction="rtl">

Then i define in my grid  <MasterTableView Dir="RTL">, as a result the filter window is open all over the page width.


Is there a solution to the problem?

Thanks in advance

Avner
Dimo
Telerik team
 answered on 08 Feb 2010
1 answer
275 views

 Hello,

We have started getting the error "The state information is invalid for this page and might be corrupted." on one of our forms that use a RadEditor control. We are using VS 2008 with RadControls for ASP.Net AJAX Q2 2009 version 2009.2.701.20. This pretty much just started happening out of no where.

We have narowed it down to formatting like bolding or underling any text it causes the error. If there is no formatting there is no error.

I have done some searching on Google and tried the following with no luck:


set pages maxPageStateFieldLength="10000" in web.config file
@ Page Language="c#" EnableViewStateMAC="false" EnableViewState="true" ...
tried replacing the control with a new one
Here is the aspx code: pretty basic

<telerik:radeditor runat="server" ID="txtContent" Width="100%" EditModes="Design, Preview" ToolsFile="~/App_Data/RadEditor/BasicToolbar.xml" >   
<Modules>   
<telerik:EditorModule Name="RadEditorDomInspector" Visible="true" Enabled="true" />   
</Modules>   
</telerik:radeditor>   
 

Also, here is our BasicToolbar.xml file:

<?xml version="1.0" encoding="utf-8" ?>   
<root>   
<tools name="MainToolbar" dockable="false" enabled="true">   
<tool name="AjaxSpellCheck" />   
<tool name="Print" />   
<tool name="FindAndReplace" />   
<tool separator="true"/>   
<tool name="Cut" />   
<tool name="Copy" />   
<tool name="Bold" />   
<tool name="Italic" />   
<tool name="Underline" />   
<tool name="Paste" />   
<tool name="PasteFromWord" />   
<tool name="PastePlainText" />   
<tool name="PasteAsHtml" />   
<tool name="FormatStripper" />   
<tool separator="true"/>   
<tool name="Undo" />   
<tool name="Redo" />   
</tools>   
</root>   
 


If anyone has any idea why we are experiecing this your help would be greatly appreciated.

Rumen
Telerik team
 answered on 08 Feb 2010
4 answers
94 views

 

I need to stretch the menu which I have but when you hoverover there is a vertical line which I can't remove. I've research and tried everything I can find and need to desparately complete this.
<table width="994px" cellpadding="0" cellspacing="0" border="0">     
        <tr>    
            <td width="50px" class="tdBackgroundBlueLeft">     
                &nbsp;     
            </td>    
            <td width="894px" class="tdtop_bot_thin_blue">     
                <div class="CustomItem">     
                    <telerik:RadMenu ID="RadMenu1" runat="server"  Width="780px" Skin="Web20"   EnableEmbeddedSkins="true"      
                        BackColor="White" Style="text-align: justify" BorderWidth="0" BorderColor="White">     
                        <Items>    
                            <telerik:RadMenuItem Text="home" Font-Size="13px" Font-Bold="True" ForeColor="Navy"    
                                Style="text-align: justify; text-indent: 10px" BackColor="White" BorderWidth="0px"    
                                BorderColor="White" Font-Names="Arial" NavigateUrl="Default.aspx">     
                            </telerik:RadMenuItem>    
                       
                            <telerik:RadMenuItem Text="about us" IsSeparator="false" Font-Size="13px" Font-Bold="True"    
                                ForeColor="Navy" Style="text-indent: 20px" BackColor="White" BorderWidth="0px"    
                                BorderColor="White" Font-Names="Arial">     
                                    
                                <Items>    
                                    <telerik:RadMenuItem Width="250px" Text="market leadership" ForeColor="Navy" Style="border-top: none !important;     
                                        border-left: none !important; border-bottom: none !important; border-right: none !important">    
                                            
                                    </telerik:RadMenuItem>    
                                </Items>    
                            </telerik:RadMenuItem>    
                             
                            <telerik:RadMenuItem Text="our team" Font-Size="13px" ForeColor="Navy" BackColor="White"    
                                Style="text-indent: 20px" BorderWidth="0px" Font-Bold="True" Font-Names="Arial">     
                                 
                                <Items>    
                                    <telerik:RadMenuItem Width="250px" Text="administration" Style="border-top: none !important;     
                                        border-left: none !important; border-bottom: none !important; border-right: none !important"     
                                        ForeColor="Navy">     
                                        
                                    </telerik:RadMenuItem>    
                                </Items>    
                            </telerik:RadMenuItem>    
                                
                            <telerik:RadMenuItem Text="our services" Font-Size="13px" ForeColor="Navy" BackColor="White"    
                                Style="text-indent: 20px" BorderWidth="0px" Font-Bold="True" Font-Names="Arial">     
                                   
                                <Items>    
                                    <telerik:RadMenuItem Width="250px" Style="border-top: none !important; border-left: none !important;     
                                        border-bottom: none !important; border-right: none !important" ForeColor="Navy"    
                                        Text="market research">     
                                           
                                    </telerik:RadMenuItem>    
                                </Items>    
                            </telerik:RadMenuItem>    
                             
                            <telerik:RadMenuItem Text="case studies" Font-Size="13px" ForeColor="Navy" BackColor="White"    
                                Style="text-indent: 20px" BorderWidth="0px" Font-Bold="True" Font-Names="Arial">     
                                  
                            </telerik:RadMenuItem>    
                                
                            <telerik:RadMenuItem Text="knowledge center" Font-Size="13px" ForeColor="Navy" BackColor="White"    
                                Style="text-indent: 20px" BorderWidth="0px" Font-Bold="True" Font-Names="Arial">     
                                  
                                <Items>    
                                    <telerik:RadMenuItem Width="250px" Style="border-top: none !important; border-left: none !important;     
                                        border-bottom: none !important; border-right: none !important" ForeColor="Navy"    
                                        Text="advisor insights  ">     
                                        
                                    </telerik:RadMenuItem>    
                                </Items>    
                            </telerik:RadMenuItem>    
                        </Items>    
                    </telerik:RadMenu>    
                </div>    
            </td>    
            <td width="50px" class="tdBackgroundBlueRight">     
                &nbsp;     
            </td>    
        </tr>    
    </table>    
 

Jains
Top achievements
Rank 1
 answered on 08 Feb 2010
1 answer
151 views
Hi,
I'm having a little trouble styling the first node of my treeview, I would like to differentiate between style of rtFirst and rtTop. How can I style the first node and the top node - what classes would I ned to use?
Thanks.
Yana
Telerik team
 answered on 08 Feb 2010
3 answers
276 views
How can I open the div on the cursor positon(text blinker) inside the editor using javascipt. I found the methods
the editor.getSelection().getRange() and editor.getSelection().selectRange(rangeObject) methods.
But this will work when we select the text but my requirement is to open the div without selecting the text

Thanks
Ritu
Dobromir
Telerik team
 answered on 08 Feb 2010
3 answers
460 views
I tried to change the format of Size column in the FileExplorer Grid control. e.g., 1,234 KB, etc. with DataFormatString if possible, such as

GridBoundColumn

sc = (GridBoundColumn)e.Column;

sc.DataFormatString = "{0:###,### KB}";


However, I couldn't find a way to modifiy it. Even, I tried to make it invisible using

RadFileExplorer1.Grid.Columns.RemoveAt(1);
It makes header part disappeared, but it still shows the size value in the data grid.

I also tried to use Grid ItemDataBound as follows, it doesn't work. I found after fired RadFileExplorer1_Grid_ItemDataBound, the RadFileExplorer1 refreshes whole grid again and make it as it was, i.e., before my rendering is applied.

 

protected

void RadFileExplorer1_Grid_ItemDataBound(object sender, GridItemEventArgs e)

{

if (e.Item is GridDataItem)

{

GridDataItem item = (GridDataItem)e.Item;

item["Size"].Text = string.Format("{0:###,### KB}", item["Size"].Text);

}

}

As far as what i've successed in the format change is just an alignment as like:

 

protected

void RadFileExplorer1_Grid_ColumnCreated(object sender, GridColumnCreatedEventArgs e)

{

RadFileExplorer1.Grid.Columns[1].ItemStyle.HorizontalAlign = HorizontalAlign.Right;

RadFileExplorer1.Grid.Columns[1].ItemStyle.Width = 30;

RadFileExplorer1.Grid.Columns[1].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;

RadFileExplorer1.Grid.Columns[1].HeaderStyle.Width = 30;

}

Thanks.

Fiko
Telerik team
 answered on 08 Feb 2010
3 answers
322 views
Hi All

I have a site I am working on at work and I am using MasterPages, ContentPages and Telerik user controls.

One page I am working on is using a TreeView inside a splitter (pane 1) and a listview inside Pane 2. On the MasterPage I have
a RadAjaxManager with all the settings for specific content pages... In the process of moving to content pages code behind using a Master page property accessor for AjaxManager.

My problem is that the treeView node click updates an object datasource (ArrayList) and then the NeedDataSource event handler on the list view needs to fire to get it. Except I'm having issues with getting this all working using the Ajax Manager settings. The smart tag designer did nothing either.

I tried setting the rebind event at the Item click event on TreeView this works however after one NeedDataSource event handler has fired any other Rebinds fail with server code 500.

I had it working with the AjaxManager settings in the markup but needed to change a setting now it doesnt work.
Can anyone provide valid AjaxManager settings to set this all up.

Thanks in advance

Chris
Sebastian
Telerik team
 answered on 08 Feb 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?