Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
174 views

HI,
  I'm trying to implement a treeview in a combobox. the treeview uses WEBService mode for loadondemand. It is required that the treeview would be initialized whenever the user close and reopen the dropdown of the combobox, since the user may have checked some checkboxes and expand a few tree nodes, so the treeview has to be returned to the initial state. I tried looking up documents, demos and example for a treeview client method that could result in a  reloading of the treeview data items, nor could I find a client method from either treeview or combobox that could fire an event on the server side that I could reload the treeview from server side. Of cause there is the Ajaxrequest that could relay to the server side, but this is another problem. I tried to implement the ajaxrequest in the OnClientDropdownOpened and  OnClientDropdownOpening event and run the webservice data load function on server side. but the dropdown opened with an empty treeview (a blank area the side of the treeview). I actually encountered same delima in previouse attemps to use ajaxrequest for tooltip and rotator, grid etc. I tried avoid using ajaxrequest because I luckily found the OnItemCommand event that meets the trigger in client and fire on server criteria.   Could you advice if that is any way to reload treeview data triggered from client.
I would appreciate it very much if you could explain the problems with ajaxrequest and how to use it correctly.
Thank you very much!




<head runat="server">
    <title></title>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
       <script type="text/javascript">
           var arItems = new Array();
           function shownText() {
               if (arItems.length == 0)
                   return "";
               var text = "";
               var cnt = 0;
               for (i = 0; i < arItems.length; i++)
                   if (arItems[i].code != "-") {
                       if (cnt > 0)
                           text += "+";
                       text += arItems[i].text;
                       cnt++;
                   }
               return text;
 
           }
           function treeNodeChecked_handler(sender, args) {
 
               var comboBox = $find("<%= cmbClass.ClientID %>");
               var node = args.get_node()
 
 
               if (args.get_node().get_checked()) {
                   var item = new Object();
                   var code = node.get_value().split('|');
                   item.code = code[1];
                   item.text = node.get_text();
                   arItems[arItems.length] = item;
               }
               else {
                   var txt = node.get_text();
                   for (i=0; i<arItems.length; i++) {
                       if (arItems[i].text == txt) {
                           arItems[i].code = "-";
                           arItems[i].text = "-";
                           break;
                       }
                   }
               }
               var showtext = shownText();
               comboBox.set_text(showtext);
 //              comboBox.trackChanges();
 //              comboBox.get_items().getItem(0).set_text(showtext);
 //              comboBox.commitChanges();
 
 //              comboBox.hideDropDown();
 
               // Call comboBox.attachDropDown if:
               // 1) The RadComboBox is inside an AJAX panel.
               // 2) The RadTreeView has a server-side event handler for the NodeClick event, i.e. it initiates a postback when clicking on a Node.
               // Otherwise the AJAX postback becomes a normal postback regardless of the outer AJAX panel.
 
 //              comboBox.attachDropDown();
 
           }
           function StopPropagation(e) {
               if (!e) {
                   e = window.event;
               }
 
               e.cancelBubble = true;
           }
 
           function dropdownOpened_handler(sender, eventArgs) {
               var ajaxManager = $find("<%= cmbAjaxManager.ClientID %>");
               ajaxManager.ajaxRequest("");
 
           }
        </script>
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
     
        <telerik:RadComboBox ID="cmbClass" Runat="server" Skin="Windows7"
            DropDownWidth="500px"
            Height="300px" Width="250px" AutoPostBack="true" onload="cmbClass_Load" 
            ontextchanged="cmbClass_TextChanged"  >
           <ItemTemplate>
              <div id="div_tv">
                <telerik:RadTreeView ID="tvClass" runat="server" Height="400px" Width="500px"  OnClientNodeChecked="treeNodeChecked_handler"
                      Skin="Windows7" CheckBoxes="True" CheckChildNodes="True">
                    <WebServiceSettings Path="CategoryComboBox.aspx" Method="GetClassItems" />
                </telerik:RadTreeView>
              </div>
            </ItemTemplate>
            <Items>       
                <telerik:RadComboBoxItem Text="" />   
            </Items>
        </telerik:RadComboBox>
     
    </div>
    <telerik:RadAjaxManager runat="server" id="cmbAjaxManager" >
    </telerik:RadAjaxManager>
    </form>
</body>
I CAN LOAD THE TREEVIEW IN ONLOAD EVENT CORRECTLY      
 protected void cmbClass_Load(object sender, EventArgs e)
        {
            RadTreeView tv = cmbClass.Items[0].FindControl("tvClass") as RadTreeView;
            LoadRootNodes(tv, TreeNodeExpandMode.WebService);
 
        }
USING AJAXREQUEST FAILED TO DISPLAY THE TREEVIEW CORRECTLY
        protected void cmbAjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            RadTreeView tv = cmbClass.Items[0].FindControl("tvClass") as RadTreeView;
            LoadRootNodes(tv, TreeNodeExpandMode.WebService);
        }

 

Ivana
Telerik team
 answered on 10 Oct 2011
2 answers
134 views
My paged radgrid (client-side bound) has a small problem:  When I reach the last page, there are fewer than <PageSize> rows in it, which causes the grid to get shorter. This is inconvenient because you have to move your mouse up the page a bit to reach the paging controls.  Is there a way to keep the last page from rolling up?  I just want to keep my paging controls from jumping all over the screen.

This behavior can be seen in the "numeric pager" example on this demo: http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/paging/defaultcs.aspx

Phil
Phil Hadley
Top achievements
Rank 1
 answered on 10 Oct 2011
1 answer
232 views
Hi guys,

I'm trying to implement Metro theme from this page:
http://www.telerik.com/support/skins/details/metro-skin-for-asp-net-ajax.aspx

I downloaded it added as a theme

MetroInVisualStudio.png

And registered in web config with those AppSettings

 
<appSettings>
  <add key="Telerik.EnableEmbeddedSkins" value="false" />
  <add key="Telerik.EnableEmbeddedBaseStylesheet" value="false" />
  <add key="Telerik.Skin" value="Metro" />   
</appSettings>


And get this result : metroresult.png

What I need to do more? Thanks

Bozhidar
Telerik team
 answered on 10 Oct 2011
0 answers
57 views

Hi,

In our product we are using entity framework validation. But these valdiations are performing from server side. I just want to make sure which one is better, asp.net server side validations or Entity framework validations.

We are using telerik controsl.

Could some one please help me regarding this

Thanks in advance
prathyusha
Top achievements
Rank 1
 asked on 10 Oct 2011
1 answer
68 views


telerik:RadDatePicker . should clear the that text box value ,
how i restrict that


Thanks,
Mohamed.
mohamed
Top achievements
Rank 1
 answered on 10 Oct 2011
4 answers
189 views
I have a RadioButtonList that gets its elements via a SqlDataSource
<asp:RadioButtonList ID="rblRadioButtons" runat="server" AutoPostBack="True" DataSourceID="ComboBoxDataSource"
    DataTextField="Name" DataValueField="ID" RepeatColumns="4" RepeatDirection="Horizontal">
</asp:RadioButtonList>

When I try to make on of the elements selected by default in the Page_Load (e.g. rblRadioButtons.SelectedValue = "2")

The bound RadComboBox in my insert/edit form (EditFormType="WebUserControl") doesn't change it's selection whenever the selected value = 2.
<telerik:RadComboBox ID="MealID" SelectedValue='<%# Bind("ID") %>' runat="server"
      DataSourceID="ComboBoxDataSource" DataTextField="Name" DataValueField="ID">
</telerik:RadComboBox>

So if the elements returned by ComboBoxDataSource are:

Name        ID
One           1
Two           2
Three        3
Four          4 

...when the RadioButtonList has a selected value of 2, the RadComboBox should show "Two" but it doesn't. However, if you select 1, 3, or 4, the radComboBox shows the right entry of "One, "Three", and "Four" respectively.

Also, I want to note, that if I comment out the RadAjaxManager, it works fine for all elements 1, 2, 3 and 4.

I hope this made sense and thanks for the help.
Chris
Top achievements
Rank 1
 answered on 10 Oct 2011
4 answers
198 views
Hi Telerik Team,

I have a RadGrid requirement that needs "InPlace" Editmode in which there need to be two dropdown columns one depends on other dropdown selection...

so i have seen a example in your site 

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/validation/defaultcs.aspx

in this example when "Adding new Record" can i load data in second "Dropdownlist" depending on the first "Dropdownlist" selected value.
If so what is the best template column i can use to have an access on Dropdownlists.

Can u please guide me with correct approach how to obtain this requirement.

Its urgent...Please do respond

Thanks in Advance
Pavlina
Telerik team
 answered on 10 Oct 2011
7 answers
593 views
Hi,

Using v2009.1.402.35, I use a WebUsercontrol popup to insert/edit record in a grid. In that popup, I have a <div> on which I toggle the css "display" property.

My problem is that the "background" window is not resizing properly to accommodate the new height of the control. The result is that the content overflows under the window.

<EditFormSettings EditFormType="WebUserControl" UserControlName="~/UserControls/TelerikHelpers/ExtraQuestionPopup.ascx" 
   CaptionFormatString="Edit extra question: {0}" CaptionDataField="ShortLabel"> 
   <PopUpSettings Modal="true" Width="525px" /> 
</EditFormSettings> 

Is there a way to force the redrawing of the popup window so that it take into account to height variations when I toggle the div's display from "none" to "" ?

Thanks,

Dominic.
Pavlina
Telerik team
 answered on 10 Oct 2011
1 answer
192 views
Hi,

I need set node position in telerik treeview.
As of now i could see only the default position for all treenodes in telerik treeview but i have to customize position as i attached.





Thanks and Regards
Manikandan Kumar
Kate
Telerik team
 answered on 10 Oct 2011
0 answers
299 views
hi all,
  I need context menu in cell click or image button click instead of right click like popup menu
I have GridImageColumn in the grid. When i click the particluar cell or image i need to open my context menu and highlight the clicked row as selected and i can pass the selected row to the rad window.

I did except the row selection and id picking. Can anyone help me about this?

My page is:

  function showMenu(e) 
    {
        var contextMenu = $find("<%= RadContextMenu1.ClientID %>");
        contextMenu.show(e);
//        $telerik.cancelRawEvent(e);
    }
  
    function MenuItemClicked(sender, eventArgs) {
  
            var clickedItemValue = eventArgs.get_item().get_text();
            switch(clickedItemValue)
            {
                case "Option2":
                var win = radopen("WebForm2.aspx?id=" + clickedItemValue, "RadWindow1");
                var oWnd = GetRadWindowManager().getActiveWindow();
                    oWnd.maximize();
                    return false;
                    break;
                default:
                    alert(clickedItemValue);
                    break;
            }
    }
  
  
</script>
  
  
    <Telerik:RadContextMenu id="RadContextMenu1" runat="server"
         EnableRoundedCorners="true" EnableShadows="true" OnClientItemClicked="MenuItemClicked">
    <Items>
        <Telerik:RadMenuItem Text="Option1" />
        <Telerik:RadMenuItem Text="Option2" />
        <Telerik:RadMenuItem Text="Option3" />
    </Items>
    </Telerik:RadContextMenu>
  
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" >
    <MasterTableView runat="server">
        <Columns>
            <telerik:GridTemplateColumn>
                <ItemTemplate>
                    <asp:ImageButton ID="imgMenu" runat="server" ImageUrl="" OnClientClick="showMenu(event)" />
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridImageColumn HeaderText="#" ImageUrl="" ></telerik:GridImageColumn>
            <telerik:GridBoundColumn HeaderText="User Name" DataField="UserName"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="First Name" DataField="FirstName"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Last Name" DataField="LastName"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Email" DataField="Email"></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    </telerik:RadGrid>
        <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false"
        ReloadOnShow="true" runat="server" EnableShadow="true">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Close" >
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>

Here i can click and show the context menu by putting asp image in the template column but how can i get the row of the image and highlight the row?

Instead i try with GridImageColumn. But not found any cell click event or click  in Imagecolumn events. So how can i achive this?
Akhil Raj
Top achievements
Rank 1
 asked on 10 Oct 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?