Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
213 views
ASP.NET 2.0 application

I am creating a custom image button control that will be used for a help system within our application.  I wish to use the RadWindow to display our help text in a modal, sized window that is not pop-up-blocked.  The idea is that this custom control can be used by myself and other developers in our applications in a simple process of add the control to the page, set the properties, done.

There is no guarantee that the page that this custom control is added to will contain a RadWindowManager, but it may.  I have code to loop through the page's controls, in a recursive manner,  in order to locate the RadWindowManager if it exists.  If one does not exist, I create one and add it to the page's controls collection...oh, wait...this throws an exception about not being able to modify the controls collection during a certain event. 

I attempted to add the RadwindowManager to the controls collection of my image button and that did not cause an error, but radOpen does not work because GetRadWindowManager can't find the RadWindowManager.  When I view the source of my page, the RadWindowManager that I added to the controls collection of my image button is not there.

Is there another way to add the RadWindowManager to the page's controls collection so it can be used?  Can I create the radwindow on the client and then open it  via javascript?

Thanks,

Sean M. Severson
Sean Severson
Top achievements
Rank 1
 answered on 16 Sep 2009
5 answers
462 views
Dear all

I added the validation (on server-side) for some fields of my grid. It's working fine.

But, I'd like to add, that if the field is blank/empty the validation fails as well. I found out, that when my code is running and the field is blank it's not running through the validation. Plelase find here the code of the asp and the vb I used:

          <telerik:GridTemplateColumn HeaderText="Zip Code" UniqueName="TemplateColumn">  
          <EditItemTemplate> 
          <asp:TextBox id="TextBox1" runat="server" Text='<%# Bind("zipcode") %>' MaxLength="4"></asp:TextBox> 
            <asp:CustomValidator id="CustomValidator1" runat="server"   
            ErrorMessage="please enter a zip code" 
            ControlToValidate="TextBox1" 
            OnServerValidate"CustomValidator1_ServerValidate">  
            </asp:CustomValidator> 
            </EditItemTemplate> 
            <ItemTemplate> 
             <asp:Label ID="label1" runat="server" Text='<%# Eval("zipcode") %>'></asp:Label> 
            </ItemTemplate> 
          </telerik:GridTemplateColumn> 

    Protected Sub CustomValidator1_ServerValidate(ByVal [source] As ObjectByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)  
        Dim i As Integer 
        Try 
            i = Convert.ToInt16(args.Value)  
        Catch ex As Exception  
            args.IsValid = False 
        End Try 
 
        If args.Value.Length <> 4 Then 
            args.IsValid = False 
        End If 
    End Sub 'CustomValidator1_ServerValidate 

As already said, it's working fine, it's just not running the CustomValidator1_ServerValidate code if the field zipcode is left blank by the user.

Does anybody has some ideas, solutions or is there anything I did wrong?

Thanks in advance for your help

Cheers

Marino


Sebastian
Telerik team
 answered on 16 Sep 2009
1 answer
86 views
Hello,

I recently updated to Q2 2009 controls.  I have a website which is hosted on a server owned by discountASP.net.  What do i need to do to get these controls to work on their server since I do not have direct access to it?  Before I just copied the bin folder with dll to the server, can I still do it that way?  Does both dlls need to be added?  (Telerik.Web.Design and Telerik.Web.UI).

Thanks.
Paul
Telerik team
 answered on 16 Sep 2009
2 answers
123 views
Hello, all,
I'm using the latest release of ASP.NET Ajax controls, and I'm facing a rather strange situation on one RadComboBox.

Actually I have a project where a particular combo box need to be loaded with one item (the default item: just setting RadCombo1.Text="something"; is not enough, for me). When an user opens it, this default value needs to be highlighted, because user has to be able of typing something into it. It has, amongst others, the following properties...

  • EnableLoadOnDemand="true"
  • MarkFirstMatch="true"
  • EnableTextSelection="true"
  • AllowCustomText="true"
... and the following client events:
  • OnClientDropDownOpening="OnClientDropDownOpening"
  • OnClientDropDownOpened="OnClientDropDownOpened"
  • OnClientDropDownClosed="OnClientDropDownClosed"
  • OnClientItemsRequesting="OnClientItemsRequesting"
  • OnClientFocus="OnClientFocus"
  • OnClientItemsRequested="OnClientItemsRequested"

Well, when I load it for the first time, "OnClientItemsRequested" fires twice; plus, and here's the strange behavior, at the first time the default value is correctly highlighted (this combo box is correctly filled with all values), but at the second time the cursor goes to the end of text. If I close it and re-open it, default value is correctly highlighted.

I already tried to set this combo box text with the item text and then selecting it on "OnClientDropDownOpened", with no success. I tried also to mimic "MarkFirstMatch" as explained here:

http://www.telerik.com/community/forums/aspnet/combobox/radcombobox-loadondemand-itemsrequested-firing-multiple-times.aspx

but, since I also need to highlight the text (so, EnableTextSelection="true"), I'd need to at least set an automatic postback on this control, what it's not ok for me, due to performance reasons.





Any hint?
Thank you!

Ciao,
Sabrina.
Sabrina Lanzoni Gonçalves
Top achievements
Rank 1
 answered on 16 Sep 2009
2 answers
162 views
Hi, i need to add a new property to each of the column types that are supported by the RadGrid.  Is there a way to do this without having to inherit from each of the column types and add the property there?
Shinu
Top achievements
Rank 2
 answered on 16 Sep 2009
3 answers
323 views
Hi,

I have a situation where I have 4 buttons and a RadGrid.  Each of the 4 buttons will set different column orders, visibility and widths.  Current I have theses enabled

<

 

Resizing AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" />

 


What is happening is say I click on button 1 which sets each of the 4 columns headerstyle.width to 50px.  Then I hit button 2 which sets each of the 4 columns headerstyle.width to 100px.  I then drag column 1's width to like 200px.  Now I hit button 1 again.  My columns do not go back to 50px each.  However the second i start to drag any 1 of the columns for resizing after i hit the button 1 again the other columns immediatly shoot back to the 50px.

Why would setting the headers width not work, but as soon as i engage the dragging for resize mechanism again they all seem like they flip back to the width that was set?  Is there any way i can ensure that after i have programatically changed all of the columns header widths that they will actually be displayed as such?
Pavel
Telerik team
 answered on 16 Sep 2009
2 answers
178 views
This is my radwindow. When i click button its not popup. where is the problem

 <script type="text/javascript">
        //<![CDATA[
        function openWin()
        {
            var oWnd = radopen("http://www.telerik.com", "RadWindow1");
        }
        
        
        //]]>
    </script>


<telerik:RadWindowManager OnClientClose="OnClientClose" OnClientPageLoad="OnClientPageLoad"
            OnClientResize="SetWindowBehavior" OnClientShow="SetWindowBehavior" Behaviors="Resize, Close, Maximize, Move"
            ID="RadWindowManager" DestroyOnClose="True" RestrictionZoneID="RestrictionZone"
            runat="server" Behavior="Resize, Close, Maximize, Move"
        InitialBehavior="None" Left="" style="display: none;" Top="">
            <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Close" OnClientClose="OnClientClose"
                NavigateUrl="http://www.telerik.com">
            </telerik:RadWindow>
            <telerik:RadWindow ID="RadWindow2" runat="server" Width="650" Height="445" Modal="true" NavigateUrl="Dialog2.aspx">
            </telerik:RadWindow>
        </Windows>
        
        </telerik:RadWindowManager>
        
                <button runat="server" id="sad" onclick="openWin(); return false;">
            Choose Destination and date</button>           







Svetlina Anati
Telerik team
 answered on 16 Sep 2009
1 answer
119 views

hi,

I've a user control and the page that holds it has a Radscriptmgr.

I've the foll js fn:
 <script type="text/javascript">

    //js function which calls the makeUnselectable().
    function OnClientLoad(combobox, args)
    {
       makeUnselectable(combobox.get_element());
    }

    //Make all combobox items unselectable to prevent selection in editor being lost
    function makeUnselectable(element)
     {
       var nodes = element.getElementsByTagName('*');
       for (var index = 0; index < nodes.length; index++) {
          var elem = nodes[index];
          elem.setAttribute('unselectable', 'on');
       }
    }

    //js function which isused to get refernce of the client object
    function getSelected()
     {
       //get a reference to Radcombobox client object
       var obTagCombo = $find('<%=m_radTagCombo.ClientID %>');

       //get_value() returns the value of the control
       var value = obTagCombo.get_value();

       //get_text()returns the text of the control.
       var text = obTagCombo.get_text();

       //get a reference to RadEditor client object
       var editor = $find("<%=m_radEmailEditor.ClientID%>");

       //pasteHtml method is used to paste the contents passed to the editor control.
       editor.pasteHtml(text);
    }  
</script>

and i call it 

<input type="button" value="Insert Tag" onclick="getSelected();" />

and in radcombobox:   <telerik:RadComboBox ID="m_radTagCombo" OnClientLoad="OnClientLoad" runat="server">
                        </telerik:RadComboBox>

I need to select text from radcombo and click the insert btn and the selected text from radcombo gets pasted on to the radeditor.

Now, I get a "Microsoft JScript runtime error: 'OnClientLoad' is undefined"

Pls help me with code:

Svetlina Anati
Telerik team
 answered on 16 Sep 2009
8 answers
798 views
Hi,

I have a simple grid with an editable column of type string as follows:
<form id="form1" runat="server"
<div> 
    <telerik:RadScriptManager ID="radScriptManager1" runat="server" /> 
    <telerik:RadGrid ID="radGrid1" AutoGenerateColumns="false" GridLines="Vertical" OnItemCreated="radGrid_ItemCreated" OnNeedDataSource="radGrid_NeedDataSource" OnUpdateCommand="radGrid_UpdateCommand" runat="server"
        <ClientSettings> 
            <Scrolling UseStaticHeaders="true" /> 
        </ClientSettings> 
        <MasterTableView EditMode="InPlace" TableLayout="Fixed"
            <Columns> 
                <telerik:GridBoundColumn DataField="Description" DataType="System.String" HeaderText="Description" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" UniqueName="Description" /> 
                <telerik:GridEditCommandColumn ButtonType="LinkButton" UniqueName="Edit" /> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
</div> 
</form> 

I would like to prevent the following characters to be entered by the user into the editable column:
<
>
&
"
'

The code behind for the code is as follows:
public partial class Grid : System.Web.UI.Page 
    private ArrayList _data; 
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!IsPostBack) 
        { 
            this._data = Data.Load(); 
            Session["DATA"] = this._data; 
        } 
        else 
        { 
            this._data = (ArrayList)Session["DATA"]; 
        } 
    } 
 
    protected void radGrid_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
        { 
            GridEditableItem item = (GridEditableItem)e.Item; 
            TextBox textbox = (TextBox)item["Description"].Controls[0]; 
            textbox.Width = Unit.Percentage(99);
        } 
    } 
 
    protected void radGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    { 
        this.radGrid.DataSource = this._data; 
    } 
 
    protected void radGrid_UpdateCommand(object sender, GridCommandEventArgs e) 
    { 
        if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
        { 
            GridEditableItem item = (GridEditableItem)e.Item; 
            ((Data)(this._data[item.ItemIndex])).Description = ((TextBox)item["Description"].Controls[0]).Text; 
            Session["DATA"] = this._data; 
        } 
    } 
 
public class Data 
    public string Description { getset; } 
 
    public Data(string description) 
    { 
        Description = description; 
    } 
 
    public static ArrayList Load() 
    { 
        ArrayList arrayList = new ArrayList(); 
        arrayList.Add(new Data("Cheeses")); 
        arrayList.Add(new Data("Prepared meats")); 
        arrayList.Add(new Data("Seaweed and fish")); 
        return arrayList; 
    } 


Can you please help me how to do this? Do I need to write an event handler for the textbox in radGrid_ItemCreated?
Please show me the code to be inserted above to do this job.

Thanks & regards,
Herman Gouw
Skype: hermangouw
Kara Eser
Top achievements
Rank 1
 answered on 16 Sep 2009
1 answer
103 views
Hi,

I am trying to add data from a database to the context menu of a RadTree.
The data also needs to be updated when the database is updated.

Currently my RadTree looks like the following;

...item1
...item2                                     
...item3 ------> (upon right click) A-C > apple, banana, carrot
                                                  D-F > dog, fish .....etc
                                                  G-I
                                                  J-L
                                                  M-O
                                                  P-S
                                                  T-V
                                                  W-Z

The bold text indicates the information in the database, which i want to display.

I would like to be able to put everything in my database in a subcategory depending on the name in each of these sections.
Any help would be greatly appreciated.

Thanks
Phil
Mouse
Top achievements
Rank 1
 answered on 16 Sep 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?