Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
168 views
Hi,

I am fairly new to ASP.NET.  I am having a bit of difficulty trying to use the treeview drag and drop as a means of ordering pages.

The use case is to allow the user to have the ability drag a node and move it to a new location in the same control and then save to the database.

My database structure is the same as the rad menu example...

Table: tblPages
Column: PageID
Column: ParentID
Column: PageTitle

Here is my control setup.

<telerik:RadTreeView ID="RadTreeView2" runat="server" EnableDragAndDrop="True" DataFieldID="PageID"
        DataFieldParentID="ParentID" DataSourceID="SqlDataSource1" DataTextField="PageTitle"
        Skin="Web20">
        <CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation>
        <ExpandAnimation Duration="100"></ExpandAnimation>
    </telerik:RadTreeView>
  <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT * FROM [tblPages]"></asp:SqlDataSource>

I have nothing in my code behind. I tried using the examples but can't get anything to work without errors in VS 2008, complaining about the code.

Any help in a direction or pointing to a sample that is related to my goal  would be great. I have lost what hair I had left from trying to work with the demos. : (

Atanas Korchev
Telerik team
 answered on 22 Sep 2008
1 answer
175 views
Hi,
     I am using the RADGRID in the editmode with lot of template columns.My grid code is below.

On click of a button 'Save all'(outside grid) ,I want to check all the rows in the grid for valid data;Like there is a dropdown with '--Select--' value,but the user must enter some value ,can some body tell me how this can be achieved.

The goal is to iterate through the grid rows and check for individual values in the cells.

<

telerik:radgrid

runat="server"

ID="rdTripWaypoints"

AutoGenerateColumns=False

Skin="RadControls"

GridLines="None"

EnableEmbeddedSkins="False"

CellPadding="0"

AllowSorting="True"

onitemdatabound="rdTripWaypoints_ItemDataBound"

onitemcommand="rdTripWaypoints_ItemCommand"

onprerender="rdTripWaypoints_PreRender"

onneeddatasource="rdTripWaypoints_NeedDataSource"

onitemcreated="rdTripWaypoints_ItemCreated">

<

PagerStyle PrevPageImageUrl="PagingPrev.gif" NextPageImageUrl="PagingNext.gif" FirstPageImageUrl="PagingFirst.gif" LastPageImageUrl="PagingLast.gif"></PagerStyle>

<MasterTableView EditMode =InPlace>

<

CommandItemSettings AddNewRecordImageUrl="AddRecord.gif" RefreshImageUrl="Refresh.gif"></CommandItemSettings>

<

RowIndicatorColumn FilterImageUrl="Filter.gif" SortAscImageUrl="SortAsc.gif" SortDescImageUrl="SortDesc.gif" Visible="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn ExpandImageUrl="SinglePlus.gif" CollapseImageUrl="SingleMinus.gif" FilterImageUrl="Filter.gif" SortAscImageUrl="SortAsc.gif" SortDescImageUrl="SortDesc.gif" Visible="False" Resizable="False">

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<Columns>

<telerik:GridTemplateColumn HeaderText ="Stop" UniqueName="Stop" >

<ItemTemplate>

<asp:Label ID="lblStop" runat =server CssClass="TxtVer11blackpadding" Width= "25px" >

</asp:Label>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText ="Location Name" uniqueName = "ddlLocationName" Visible =true >

<ItemTemplate>

<asp:DropDownList Width="140px" runat =server ID ="ddlLocationName" CssClass="TxtVer11blackpadding" AutoPostBack=true ></asp:DropDownList>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText ="ETA" UniqueName="ETA" >

<ItemTemplate>

<asp:Label ID="lblETA" runat =server CssClass="TxtVer11blackpadding" Width= "40px" >

</asp:Label>

</ItemTemplate>

<ItemStyle Wrap="False" />

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText ="Appx Offload Time" UniqueName="AppxOffLoadTime" >

<ItemTemplate>

<asp:TextBox ID="txtAppxOffLoadTime" runat =server CssClass="TxtVer11blackpadding" Width="40px">

</asp:TextBox>

<asp:Label ID="lblOffLoadTime" runat =server CssClass="TxtVer11blackpadding" Visible="false" Width="40px">

</asp:Label>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText ="Appx Departure Date" uniqueName = "AppxDepartureTime" Visible =true>

<ItemTemplate>

<telerik:RadDateTimePicker style=" top:10px; " id="dtpDepDate" tabIndex=11 runat="server" Width="150px" Skin="RadControls" EnableTyping="False" EnableEmbeddedSkins="False" BackColor="Transparent" BorderColor="Transparent" Calendar-ClientEvents-OnDateSelecting="OnDateSelecting">

<TimePopupButton HoverImageUrl="~/RadControls/Calendar/time.gif" ImageUrl="~/RadControls/Calendar/time.gif" CssClass="radPopupImage_RadControls" TabIndex="12" />

<TimeView EnableEmbeddedSkins="False" Skin="RadControls" TimeFormat="HH:mm:ss" TabIndex="14">

</TimeView>

<DateInput DateFormat="MM/dd/yyyy HH:mm" Font-Names="verdana" Font-Size="11px" InvalidStyleDuration="100" EnableEmbeddedSkins="False" LabelCssClass="radLabelCss_RadControls" Skin="RadControls" ReadOnly="True" TabIndex="11">

<ClientEvents OnError="HandleError" />

</DateInput>

<Calendar EnableEmbeddedSkins="False" Skin="RadControls" FastNavigationNextImage="~/RadControls/Calendar/fastNavRight.gif" FastNavigationPrevImage="~/RadControls/Calendar/fastNavLeft.gif" NavigationNextImage="~/RadControls/Calendar/arrowRight.gif" NavigationPrevImage="~/RadControls/Calendar/arrowLeft.gif">

</Calendar>

<DatePopupButton HoverImageUrl="~/RadControls/Calendar/calendar.gif" ImageUrl="~/RadControls/Calendar/calendar.gif" CssClass="radPopupImage_RadControls" TabIndex="11" />

</telerik:RadDateTimePicker>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText ="Distance" UniqueName="Distance" >

<ItemTemplate>

<asp:Label ID="lblDistance" runat =server CssClass="TxtVer11blackpadding" Width= "40px" >

</asp:Label>

</ItemTemplate>

<ItemStyle Wrap="False" />

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText ="Latitude" UniqueName="Latitude" >

<ItemTemplate>

<asp:Label ID="lblLatitude" runat =server CssClass="TxtVer11blackpadding" Width= "40px" >

</asp:Label>

</ItemTemplate>

<ItemStyle Wrap="False" />

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText ="Longitude" UniqueName="Longitude" >

<ItemTemplate>

<asp:Label ID="lblLongitude" runat =server CssClass="TxtVer11blackpadding" Width= "40px" >

</asp:Label>

</ItemTemplate>

<ItemStyle Wrap="False" />

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText ="Charge Code" uniqueName = "ddlChargeCode" Visible =true>

<ItemTemplate>

<asp:DropDownList Width="140px" runat =server ID ="ddlChargeCode" CssClass="TxtVer11blackpadding" ></asp:DropDownList>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn UniqueName ="btn" >

<ItemTemplate >

<asp:ImageButton runat = server ID="ibtnAdd" Text = "Add" ToolTip="Add a row below" CommandName ="Add" ImageUrl="../images/Add.GIF" />

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn UniqueName ="btn" Visible =true >

<ItemTemplate >

<asp:ImageButton runat = server ID="ibtndelete" Text = "Delete" ToolTip="Delete row" CommandName ="Del" ImageUrl="../images/Delete.GIF" />

</ItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

<

EditFormSettings>

<

EditColumn InsertImageUrl="Insert.gif" UpdateImageUrl="Update.gif" EditImageUrl="Edit.gif" CancelImageUrl="Cancel.gif" FilterImageUrl="Filter.gif" SortAscImageUrl="SortAsc.gif" SortDescImageUrl="SortDesc.gif"></EditColumn>

<

PopUpSettings ScrollBars="None"></PopUpSettings>

</

EditFormSettings>

<

PagerStyle PrevPageImageUrl="PagingPrev.gif" NextPageImageUrl="PagingNext.gif" FirstPageImageUrl="PagingFirst.gif" LastPageImageUrl="PagingLast.gif"></PagerStyle>

</MasterTableView>

</telerik:radgrid>


 

Sebastian
Telerik team
 answered on 22 Sep 2008
4 answers
124 views
Hello!

I want to place a user control inside of AJAXLoadingTemplate. (The purpose is to show localized images depending on current culture)
But for dealing this datagrid data I use RadGrid_NeedDataSource event and, thus, do not call DataBind() method explicitly. As a result - data in AJAXLoadingTemplate is not bound and there is no images while loading.
What can I do in order to bind data in AJAXLoadingTemplate?

Thanks!
Kseniya Garipova
Top achievements
Rank 1
 answered on 22 Sep 2008
1 answer
107 views
Is there any way I can set a custom css class through the window manager or on a window itself.
Obi-Wan Kenobi
Top achievements
Rank 1
 answered on 22 Sep 2008
1 answer
153 views

Hi,

I need a scenario where the menu structure inculding each of the individual menu items are loaded depending on the user's login.
This information comes from a database. Im using the telerik RadMenu. Now the only way i can see how to do this is 'loading' the items depending on the user (or user's role) on each page load:

    protected void Page_Load(object sender, EventArgs e)
    {

        PopulateMenuItems( thisUser.Role );
    }

But this seems very inefficient. By 'inefficient' i mean rendering the menu on a per-page basis. I know about the databinding, but doesn't this mean ill have to define the menu structure for EVERY user (or user role) in the system (which is way too many). Is there some other way?

Doing it on a per-page basis seems long-winded. Is there a way to do it on a per-login basis (i.e. only 'once' when the user logs in?). Isnt there a way to say define the menu structure 'once' when the user logins in, thus the menu items can simply be displayed?

Thanks.

Atanas Korchev
Telerik team
 answered on 22 Sep 2008
2 answers
176 views
I have a Grid with an Edit FormTemplate which has six controls of Type RadNumericTextBox all sitting inside a table.

The grid goes into edit mode and, as each textbox has data entered into it, I need to be able to find the other five, get their values and keep a running total which I'll be displaying elsewhere on the page. I have the grid ajaxified and each control has autopostback="true". I have the onTextChanged event for each textbox wired and I'm seeing each control fire in code behind.

So far so good. However, I cannot find the other five textboxes. So far in the research I've done, I see many examples of using grid events such as editing and inserting etc which gives an easy path to find the controls using:

GridEditFormItem item = e.Item as GridEditFormItem;

However, all I have is either the sender as my RadNumericTextBox or RadGrid1 as a starting point for any contained controls.

Can anyone help point me in the right direction.

Thanks, Steve
Steve Y
Top achievements
Rank 2
 answered on 22 Sep 2008
1 answer
103 views

On clientside how can I tell if a child tab is selected when itterating the RadTabCollection

 function LoadSelected(sender, eventArgs)
    {
    var tab = eventArgs.get_tab();
   
    //If we don't have any child tabs, we'll exit
    var TabSubCount = tab.get_tabs().get_count();
    if ( TabSubCount == 0 ) { return false; }
  
   
    for (var i = 0; i < TabSubCount; i++)
        {
            How to tell if tab.get_tabs().getItem(i) is selected ?
             Something like
              alert(tab.get_tabs().getItem(i).selected);  
        }
    }

 

Princy
Top achievements
Rank 2
 answered on 22 Sep 2008
3 answers
150 views
I have placed a RadTreeView control in a web application that I created. I am trying to test the control for the first time, and I am receiving an error page when the control attempts to render. The error is:$0$0$0$0Method not found: 'BooleanSystem.Web.UI.ScriptManager.get_LoadScriptsBeforeUI()'.$0$0$0$0$0$0I have searched (Google) for the method "get_LoadScriptsBeforeUI()", and I have not found anything. The closest thing I found was the "LoadScriptsBeforeUI" property, which is described in MSDN.$0$0$0$0$0Does anyone have any suggestions as to how I can debug/fix this?$0$0$0$0$0Thanks$0$0$0$0$0Also...I am getting mysterious "There is an error in XML document (1, 145)" messages when I attempt to use the LoadXml function of the RadTreeView. The XML I am attempting to load is valid and can be viewed in an XML viewer. If I put in a very simple XML string like:$0$0$0$0$0"<Tree><Node AccessKey='0' Value='0' Text='VectorCSP WPM'></Node></Tree>" $0$0$0$0$0$0$0$0$0$0it seems to work. But a larger one, with many, many more nodes, does not. I can't seem to pin point the problem here, either.$0$0$0$0$0Any help would really be appreciated.$0$0Thank you.$0$0$0$0
Atanas Korchev
Telerik team
 answered on 22 Sep 2008
2 answers
167 views
I am fighting with the combo box and am almost ready to give up.

I need to be able to retrieve the values but it does not seem to work like the DropDownList Does... what am I doing wrong?

This part works fine
            Dim PagesDC As New Dal.icms_PagesDataContext  
            Dim ParentPages = PagesDC.icms_Pages_GetParentPages()  
            ddlParentPage.DataSource = ParentPages  
            ddlParentPage.DataTextField = "MenuName" 
            ddlParentPage.DataValueField = "ID" 
            ddlParentPage.DataBind()  
            ddlParentPage.Items.Insert(NothingNew RadComboBoxItem("[main menu]")) 

But this is throwing an error
    Protected Sub btnCreate_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnCreate.Click  
 
        Dim _UserName As String = Page.User.Identity.Name  
        Dim _isPublished As Boolean = False 
        If chkPublished.Checked = True Then _isPublished = True 
        Dim _ParentPage As Integer = Nothing 
 
        If Convert.ToInt32(ddlParentPage.SelectedItem.Value) <> Nothing Then _  
        _ParentPage = Convert.ToInt32(ddlParentPage.SelectedItem.Value)  
 
        Dim PagesDC As New Dal.icms_PagesDataContext  
        Dim insert = PagesDC.icms_Pages_CreateNewPage(_ParentPage, _  
                                                      RadComboBox1.SelectedItem.Value, _  
                                                      txtMenuOrder.Text, _  
                                                      txtMenuName.Text, _  
                                                      txtTitle.Text, _  
                                                      txtMetaKeywords.Text, _  
                                                      txtMetaDescription.Text, _  
                                                      _UserName, _  
                                                      _isPublished)  
        PagesDC.SubmitChanges()  
    End Sub 

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

Line 99:         Dim _ParentPage As Integer = Nothing
Line 100:
Line 101: If Convert.ToInt32(ddlParentPage.SelectedItem.Text) <> "[main menu]" Then _
Line 102: _ParentPage = Convert.ToInt32(ddlParentPage.SelectedItem.Value) Line 103:

Source File: D:\Development\Visual Studio\xxxxxxx.com\App_Windows\Admin_Controls\Pages.ascx.vb    Line: 101
Atanas Korchev
Telerik team
 answered on 22 Sep 2008
1 answer
110 views
Hi,
I'm binding a RadMenu directly to an ArrayList (not through an ObjectDataSource), but the child items are displaying to the right, and not underneath as one would expect. I've copied the example code from http://www.telerik.com/help/aspnet-ajax/menu_dataobjectdatasources.html using the 'Binding to an ArrayList' example word-for-word and can't seem to figure out why? I've tested in IE 7 & FF3.

My design code:
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
       
        <telerik:RadMenu ID="RadMenu1" Flow="Horizontal" runat="server">
        </telerik:RadMenu>
       
    </div>
    </form>
</body>

and code behind:
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadMenu1.DataTextField = "Text";
                RadMenu1.DataNavigateUrlField = "Url";
                RadMenu1.DataFieldID = "ID";
                RadMenu1.DataFieldParentID = "ParentID";
                RadMenu1.DataSource = GenerateSiteData();
                RadMenu1.DataBind();

                
            }
        }
        private ArrayList GenerateSiteData()
        {
            ArrayList siteData = new ArrayList();
            siteData.Add(new SiteDataItem(1, null, "All Sites", ""));
            siteData.Add(new SiteDataItem(2, 1, "Search Engines", ""));
            siteData.Add(new SiteDataItem(3, 1, "News Sites", ""));
            siteData.Add(new SiteDataItem(4, 2, "Yahoo", "http://www.yahoo.com"));
            siteData.Add(new SiteDataItem(5, 2, "MSN", "http://www.msn.com"));
            siteData.Add(new SiteDataItem(6, 2, "Google", "http://www.google.com"));
            siteData.Add(new SiteDataItem(7, 3, "CNN", "http://www.cnn.com"));
            siteData.Add(new SiteDataItem(8, 3, "BBC", "http://www.bbc.co.uk"));
            siteData.Add(new SiteDataItem(9, 3, "FOX", "http://www.foxnews.com"));
            return siteData;
        }

    }

    public class SiteDataItem
    {
        private string _text;
        private string _url;
        private int _id;
        private int? _parentId;
        public string Text
        {
            get { return _text; }
            set { _text = value; }
        }
        public string Url
        {
            get { return _url; }
            set { _url = value; }
        }
        public int ID
        {
            get { return _id; }
            set { _id = value; }
        }
        public int? ParentID
        {
            get { return _parentId; }
            set { _parentId = value; }
        }
        public SiteDataItem(int id, int? parentId, string text, string url)
        {
            _id = id;
            _parentId = parentId;
            _text = text;
            _url = url;
        }
    }

I'm using the 'RadControls 'Prometheus' for ASPNET Q3 2007'
Thanks.

Atanas Korchev
Telerik team
 answered on 22 Sep 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?