Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
65 views
Hello all,

     I have a grid in which i have few template columns. I would like to set the 2 grid template columns visibility based on the Internet connection.

Here are the controls in the template column.

  <telerik:GridTemplateColumn HeaderText="Time" UniqueName="Time" Visible = "true">
                                                              <ItemTemplate>

 <telerik:RadMaskedTextBox ID="txtTime" runat="server" PromptChar="_" Width="80px" Mask="<0..2><0..9>:<0..5><0..9>">
                            </telerik:RadMaskedTextBox>
                 </ItemTemplate>
                                <ItemStyle Wrap="False" />
                            </telerik:GridTemplateColumn>
                           
                            <telerik:GridTemplateColumn HeaderText="Odometer" UniqueName="Odometer" Visible = "true">
                                <EditItemTemplate>
                                   <asp:TextBox ID="txtOdometer"  runat="server" ToolTip="Odometer" Text='<%# Eval("Odometer") %>' Width="120px"
                                        onkeydown="return CheckKeyCode()" onfocus="this.value = this.value;" >
                                    </asp:TextBox>
                                    <asp:RegularExpressionValidator Display="Dynamic" ID="regOdometer" runat="server"
                                        ErrorMessage="Only Numbers are allowed." ControlToValidate="txtOdometer" ValidationExpression="\d+\.?\d*" /></EditItemTemplate>
                                <ItemTemplate>
                                 <asp:TextBox ID="txtOdom"  runat="server" ToolTip="Odometer" Text='<%# Eval("Odometer") %>' Width="80px"
                                        onkeydown="return CheckKeyCode()" onfocus="this.value = this.value;" >
                                    </asp:TextBox>
                                </ItemTemplate>
                                <ItemStyle Wrap="False" />
                            </telerik:GridTemplateColumn>

1) I have to set those columns visibilty based on the internet check.. How do i do this?

I am trying something like this..

function hideColumn()
{
    var grid = $find("<%=RadGrid1.ClientID %>");
    var MasterTable = grid.get_masterTableView();
     var rows = MasterTable.get_dataItems();
    var cell = MasterTable.getCellByColumnUniqueName(rows, "Time");
for(i=0;i <rows.length-1;i++)
{
 rows[i].cells[cell].style.display="none";
}
}

2) How do i access a column?
3) Where should i call this hidefunction in the below script.

$(document).ready(function() {
        $("form").submit(function(e) {
            var r = $.ajax({ "url": 'http://www.xxxxxxxxx.com/xxxxx', "async":false }).responseText;
           
            if( r==null ) e.preventDefault();
        })
    })


  if r is async then  i am removing the postback. and  probably at that time i have to call the hidefunction.
How do i do this?
 

Appreciate the help

Thanks
Iana Tsolova
Telerik team
 answered on 10 Oct 2011
1 answer
86 views
Hi all,

I'm implementing a user control which uses a radtreeview as filter, I need to have access to the checkbox element of each radtreenode in order to attach an onclick=Function(param1,param2..). The "OnClientNodeChecked" event does not work for me because the user control has several other controls inside, which makes obtaining clientId's a bit tricky...I tried making a template with the checkboxes for the radTreeView, but that makes useless a lot of the javascript that handles checkbox behavior (like the get_checked()).

A bit like going through a client select column in a grid...and doing something with the check...

Thanks in advance.
Plamen
Telerik team
 answered on 10 Oct 2011
1 answer
103 views
I have a RadTreeView and a RadScheduler. When I drag and drop items from the TreeView into the scheduler, i want an appointment inserted. I do not use a datasource for the Scheduler, and what I do here is on the RadTreeView.OnNodeDropping i have the following JavaScript:

 

 

function nodeDropping(sender, eventArgs) {

 

 

 

var node = eventArgs.get_sourceNode();

 

 

 

var args = node.get_value();

 

 

__doPostBack(

 

'ctl00$ContentPlaceHolder1$upTest', args);
}

Then in the page load, I catch these arguments and insert an appointment.
My problem is: how to get the date and time of the Scheduler? Meaning the spot I dropped my item on. I have searched the documentation, but I can not find a list of the functions like get_sourceNode() etc that I can use. I can use

 

eventArgs.get_htmlElement() to get a referance to the element where I dropped the item (the Scheduler), but how to get the exact position I dropped it into?

Plamen
Telerik team
 answered on 10 Oct 2011
3 answers
77 views
Hi. I am about to start using the scheduler. I have a rather complex situation and need to provide a lot of control and functionality from code behind.

I may have missed some capability but it would be useful (as a suggestion for future consideration) to have a "read only" property for appointments. I realise that there is a property for the scheduler but I have a situation where the user can view not only their appointments but also other users' appointments. I could easily set "read only" in the data source (table.userId == myId) but unless I've missed something don't see any capability that supports this.

My application is a little complex. I cannot therefore predefine a simple datasource and the code behind will have to create and bind the datasource (which I can easily do). However, that means (again unless I've missed some trick or capability) that the scheduler will not have queries for insert, delete and update. Can anyone provide a link to a simple tutorial/example of how to control these events in code behind.

In my application delete, insert and update are also complicated by the functionality being dependant on the data itself (ie whether the related appointment is the user's appointment or someone else's). Thus my code behind has to really control the whole process and probably the easiest thing is to display custom templates or user controls for the job. Again any link to simple examples would be appreciated and also just confirmation of how to override or cancel the default scheduler behaviour would be appreciated.

Thanks

PS in the documentation about the appointment class I noticed some information about "categories". If anyone can provide a link for further information about how to use them I'd appreciate it.
Plamen
Telerik team
 answered on 10 Oct 2011
3 answers
102 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
88 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
196 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
29 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
45 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
123 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?