Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
172 views
I have a rad panel that you can veiw here. http://alpha.clickablecommunity.com/ I populate this from a datatable in the code behind. What I need to do is set ever individual sub node's client clicked, and checkbox clicked event in the code behind. Basically when you expand one of the main nodes and click it, I want the checkbox to become checked and I want a specific js function to run. Also, if they click the checkbox associated with the node, I want the same js function to run. It is kind of something like this
category1
    child 1
    child 2
category2
    child 1
    child 2

Those have checkboxes and I would like to be able to run a function myFunction('someParameter'); on the check box click or on the element click itself. If the user clicks child 1 I would like the checkbox to become checked. I have to do this on the server side because I have to pass in someParameter dynamically from a db. I am completely lost as how to even approach this. Here is my code. Thanks,

<%

@ Master Language="VB" AutoEventWireup="false" CodeBehind="MasterPage.master.vb"

 

 

Inherits="ClickableCommunity.MasterPage" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

html xmlns="http://www.w3.org/1999/xhtml">

 

<

html xmlns="http://www.w3.org/1999/xhtml">

 

<%

@ import namespace="System.Data" %>

 

<%

@ import namespace="System.Data.Sql" %>

 

<%

@ import namespace="System.Data.SqlClient" %>

 

<%

@ import namespace="Telerik.Web.UI" %>

 

<

script runat="server">

 

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

 

If Not Page.IsPostBack Then

 

 

 

Dim tree As RadTreeView = DirectCast(RadPanelBar1.FindItemByText("Events").Items(0).FindControl("RadTreeView1"), RadTreeView)

 

 

'here is where the error is. it is saying that

 

 

'createtable is null

 

tree.DataSource = CreateTable()

tree.DataFieldID =

"ID"

 

tree.DataFieldParentID =

"ParentID"

 

tree.DataTextField =

"Text"

 

tree.DataBind()

 

 

End If

 

 

End Sub 'page_load

 

 

 

'this function creates a datatable for the rad

 

 

'tree that is in the events panel

 

 

Private Function CreateTable() As DataTable

 

 

'set up my connection to the database

 

 

Dim conn As New SqlConnection

 

conn.ConnectionString = ConfigurationManager.ConnectionStrings(

"connectionString").ConnectionString

 

 

Dim table As DataTable = New DataTable()

 

table.Columns.Add(

"ID")

 

table.Columns.Add(

"ParentID")

 

table.Columns.Add(

"Text")

 

 

'this is a counter for the id fields

 

 

'of the data table

 

 

Dim count As Integer = 1

 

 

 

'this adds the parent categories to the

 

 

'datatable

 

 

Dim categoryQuery As New SqlCommand

 

conn.Open()

categoryQuery.Connection = conn

categoryQuery.CommandText =

"select CategoryId, Name from categories"

 

 

Dim cdr As SqlDataReader = categoryQuery.ExecuteReader()

 

 

While cdr.Read()

 

 

 

If (cdr.Item(0).ToString <> "") Then

 

 

table.Rows.Add(

New String() {count.ToString, Nothing, cdr.Item(1).ToString})

 

 

'we have to increment count to keep an id for the data table

 

count = count + 1

 

 

End If

 

 

 

End While 'while cdr.Read()

 

conn.Close()

conn.Open()

 

'this adds the events with their parent category

 

 

'id to the datatable

 

 

Dim eventQuery As New SqlCommand

 

eventQuery.Connection = conn

eventQuery.CommandText =

"SELECT eventid, FK_CategoryID, name from events"

 

 

Dim edr As SqlDataReader = eventQuery.ExecuteReader()

 

 

While edr.Read()

 

 

 

If (edr.Item(0).ToString <> "") Then

 

 

table.Rows.Add(

New String() {count.ToString(), edr.Item(1).ToString, edr.Item(2).ToString})

 

 

'we have to increment count to keep an id for the data table

 

count = count + 1

 

 

End If

 

 

 

End While 'while edr.Read()

 

 

 

Return table

 

 

End Function 'CreateGenreTable

 

 

</

script>

 

<

head runat="server">

 

 

<link href="ClickableCommunity.css" rel="stylesheet" type="text/css" />

 

 

<title></title>

 

 

<asp:ContentPlaceHolder ID="head" runat="server">

 

 

</asp:ContentPlaceHolder>

 

</

head>

 

<

body id="MasterBody" runat="server" style="margin: 0px; height: 100%; overflow: hidden;"

 

 

scroll="no">

 

 

<form id="Form1" method="post" runat="server" style="height: 100%">

 

 

<asp:ScriptManager ID="ScriptManager1" runat="server">

 

 

</asp:ScriptManager>

 

 

<br />

 

 

<asp:ContentPlaceHolder ID="header" runat="server">

 

 

</asp:ContentPlaceHolder>

 

 

<div id="topDiv">

 

 

<div id="image" class="topDivImage">

 

 

<img src="images\logo.jpg" alt="Clickable Community Logo" width="200" height="75" />

 

 

</div>

 

 

<div id="viewMenu" class="viewMenu">

 

Menu goes here

 

</div>

 

 

</div>

 

 

<telerik:RadSplitter ID="RadSplitter1" runat="server" Orientation="Vertical" Width="100%"

 

 

Height="100%" CssClass="AllContent">

 

 

<telerik:RadPane ID="LeftRadPane1" runat="server" Width="220px" Scrolling="Both"

 

 

BorderStyle="None" BorderSize="0">

 

 

<div id="leftPanel">

 

 

<telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Web20" ExpandMode="SingleExpandedItem"

 

 

AllowCollapseAllItems="false" Width="220px">

 

 

<CollapseAnimation Type="None" Duration="100"></CollapseAnimation>

 

 

<Items>

 

 

<telerik:RadPanelItem runat="server" Text="Events" Expanded="true">

 

 

<Items>

 

 

<telerik:RadPanelItem runat="server">

 

 

<ItemTemplate>

 

 

<telerik:RadTreeView ID="RadTreeView1" runat="server" Skin="Web20"

 

 

CssClass="leftPanelContent" CheckBoxes="true">

 

 

</telerik:RadTreeView>

 

 

</ItemTemplate>

 

 

</telerik:RadPanelItem>

 

 

</Items>

 

 

</telerik:RadPanelItem>

 

 

<telerik:RadPanelItem runat="server" Text="Search" ChildGroupCssClass="leftPanelContent">

 

 

<Items>

 

 

<telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1">

 

 

</telerik:RadPanelItem>

 

 

<telerik:RadPanelItem runat="server" Text="Child RadPanelItem 2">

 

 

</telerik:RadPanelItem>

 

 

</Items>

 

 

</telerik:RadPanelItem>

 

 

<telerik:RadPanelItem runat="server" Text="Administrator" ChildGroupCssClass="leftPanelContent">

 

 

<Items>

 

 

<telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1">

 

 

</telerik:RadPanelItem>

 

 

<telerik:RadPanelItem runat="server" Text="Child RadPanelItem 2">

 

 

</telerik:RadPanelItem>

 

 

</Items>

 

 

</telerik:RadPanelItem>

 

 

</Items>

 

 

<ExpandAnimation Type="None" Duration="100"></ExpandAnimation>

 

 

</telerik:RadPanelBar>

 

 

</div>

 

 

</telerik:RadPane>

 

 

<telerik:RadSplitBar runat="server" ID="RadSplitBar2" CollapseMode="Forward" EnableResize="false"

 

 

ForeColor='Green' />

 

 

<telerik:RadPane ID="RightRadPane1" runat="server" CssClass="RightPanelPadding" Scrolling="Both"

 

 

BorderStyle="None" BorderSize="0">

 

 

<asp:ContentPlaceHolder ID="MainContent" runat="server">

 

 

</asp:ContentPlaceHolder>

 

 

</telerik:RadPane>

 

 

</telerik:RadSplitter>

 

 

</form>

 

</

body>

 

</

html>

 

Web Services
Top achievements
Rank 2
 answered on 11 Aug 2009
2 answers
201 views
Hi all,

I've implemented a hierarchy with my grid - master/detail.

One issue:Not every master record has a detail record. I'd like to hide the detail expand image and disable the click for those records without a detail level. Is that possible?

Alternatively, is there a way I can implement my own detail expand image dynamically whe the grid is loading so I can alert the user that a detail record is present?

Thanks!!
JUDY LEE
Top achievements
Rank 1
 answered on 11 Aug 2009
2 answers
142 views
This is kind of weird, I must have something not configured right.

In my hierarchical radgrid, if I leave mastertable and the detailstable and the detailstable to that one as ServerOnDemand the grid works fine.

If I change it to ServerBind or if I say HierarchyDefaultExpanded="true" then get an error.

ItemID is neither a DataColumn nor a DataRelation for table Request.


System.ArgumentException: ItemID is neither a DataColumn nor a DataRelation for table Request.



Now ItemID is a column in a datatable and Request is a datatable. The error is correct though. There is no ItemID in the Request DataTable. I don't understand why it's looking in that table though.

MasterTable binds to Request DataTable which does not have ItemID, it has ADMRequestID
DetailsTable1 binds to a RequestItems DataTable which does have an ItemID
and DetailsTable2 binds to a ClaimItems DataTable which also has an ItemID

So why it all works on ServerOnDemand but fails if I change it to ServerBind is very weird. I have the parent relations setup, but again, only works on ServerOnDemand.

<telerik:RadGrid ID="grdSearchResults"  
                                        runat="server"  
                                        Skin="Office2007"  
                                        Visible="true"> 
                                        <SelectedItemStyle BackColor="Wheat" /> 
                                        <%--<HeaderStyle BackColor="White" Font-Underline="true" Font-Italic="true" />--%> 
                                    <MasterTableView Name="Request" 
                                        AutoGenerateColumns="false"  
                                        DataKeyNames="ADMRequestID" 
                                        HierarchyLoadMode="ServerOnDemand" 
                                         
                                        PagerStyle-AlwaysVisible="true" 
                                        AllowSorting="true" 
                                        AllowPaging="true" 
                                        PageSize="50" > 
                                        <HeaderStyle /> 
                                        <ExpandCollapseColumn CollapseImageUrl="~/Images/SinglePlus.gif" ExpandImageUrl="~/Images/SinglePlus.gif"></ExpandCollapseColumn> 
                                        <Columns> 
                                            <telerik:GridBoundColumn DataField="ADMRequestID" Visible="false" /> 
                                            <telerik:GridBoundColumn DataField="IsRACRequest" Visible="false" /> 
                                            <telerik:GridTemplateColumn HeaderText="Request #" DataField="UserRequestID"> 
                                                <ItemTemplate> 
                                                    <asp:HyperLink ID="hlRequestID" runat="server" Font-Size="Small" NavigateUrl='<%# UrlRequestLink(Container.Cells(2).Text, Container.Cells(3).Text) %>' Text='<%# Eval("UserRequestID") %>' />     
                                                </ItemTemplate> 
                                            </telerik:GridTemplateColumn> 
                                            <telerik:GridBoundColumn DataField="Status" HeaderText="Status" /> 
                                             
                                            <telerik:GridBoundColumn DataField="DateOfLetter" HeaderText="Date Of Letter" DataFormatString="{0:d}" /> 
                                            <telerik:GridBoundColumn DataField="DateDue" HeaderText="Due Date" DataFormatString="{0:d}" /> 
                                            <telerik:GridBoundColumn DataField="DateMailed" HeaderText="Date Mailed" DataFormatString="{0:d}" /> 
                                            <telerik:GridBoundColumn DataField="SearchFound" Visible="false" /> 
                                        </Columns>     
                                        <%--<SelfHierarchySettings ParentKeyName="ADMRequestID" KeyName="ItemID" />--%> 
                                         
                                        <DetailTables> 
                                            <telerik:GridTableView Name="RequestItems" 
                                                AutoGenerateColumns="false"  
                                                DataKeyNames="ItemID" 
                                                HierarchyLoadMode="ServerOnDemand"> 
                                                <Columns> 
                                                    <telerik:GridBoundColumn DataField="ItemID" Visible="false" /> 
                                                    <telerik:GridBoundColumn DataField="ADMRequestID" Visible="false" /> 
                                                    <telerik:GridBoundColumn DataField="ItemType" HeaderText="Type" /> 
                                                    <telerik:GridBoundColumn DataField="ItemUserID" Visible="false" /> 
                                                    <telerik:GridBoundColumn DataField="IsRACType" Visible="false" /> 
                                                    <telerik:GridTemplateColumn HeaderText="Description" DataField="Description"> 
                                                        <ItemTemplate> 
                                                            <asp:HyperLink ID="hlClaimID" runat="server" Font-Size="Small" NavigateUrl='<%# UrlItemLink(Container.Cells(2).Text, Container.Cells(4).Text, Container.Cells(6).Text) %>' Text='<%# Eval("Description") %>' />     
                                                        </ItemTemplate> 
                                                    </telerik:GridTemplateColumn> 
                                                    <telerik:GridBoundColumn DataField="ItemDate" HeaderText="Date" DataFormatString="{0:d}" /> 
                                                    <telerik:GridBoundColumn DataField="SearchFound" Visible="false" /> 
                                                    <telerik:GridBoundColumn DataField="Duplicate" Visible="false" /> 
                                                </Columns> 
                                                <ParentTableRelation> 
                                                    <telerik:GridRelationFields DetailKeyField="ADMRequestID" MasterKeyField="ADMRequestID" /> 
                                                </ParentTableRelation> 
                                                <DetailTables> 
                                                    <telerik:GridTableView Name="ClaimItems" 
                                                    AutoGenerateColumns="false"  
                                                    DataKeyNames="ItemID" 
                                                    HierarchyLoadMode="ServerOnDemand"> 
                                                        <ParentTableRelation> 
                                                            <telerik:GridRelationFields DetailKeyField="ADMClaimID" MasterKeyField="ItemID" /> 
                                                        </ParentTableRelation> 
                                                        <Columns> 
                                                            <telerik:GridBoundColumn DataField="ItemID" Visible="false" /> 
                                                            <telerik:GridBoundColumn DataField="ADMClaimID" Visible="false" /> 
                                                            <telerik:GridBoundColumn DataField="ItemType" HeaderText="Type" /> 
                                                            <telerik:GridBoundColumn DataField="ItemUserID" Visible="false" /> 
                                                            <telerik:GridBoundColumn DataField="IsRACType" Visible="false" /> 
                                                            <telerik:GridTemplateColumn HeaderText="Description" DataField="Description"> 
                                                                <ItemTemplate> 
                                                                    <asp:HyperLink ID="hlClaimID" runat="server" Font-Size="Small" NavigateUrl='<%# UrlItemLink(Container.Cells(2).Text, Container.Cells(4).Text, Container.Cells(6).Text) %>' Text='<%# Eval("Description") %>' />     
                                                                </ItemTemplate> 
                                                            </telerik:GridTemplateColumn> 
                                                            <telerik:GridBoundColumn DataField="ItemDate" HeaderText="Date" DataFormatString="{0:d}" /> 
                                                            <telerik:GridBoundColumn DataField="SearchFound" Visible="false" /> 
                                                        </Columns>                                                 
                                                    </telerik:GridTableView> 
                                                </DetailTables> 
                                            </telerik:GridTableView> 
                                        </DetailTables> 
                                    </MasterTableView> 
                                     
                                </telerik:RadGrid> 



Protected Sub grdSearchResults_DetailTableDataBind(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles grdSearchResults.DetailTableDataBind 
        LoadGrid(e.DetailTableView.Name) 
    End Sub 
 
 
    Protected Sub grdSearchResults_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grdSearchResults.NeedDataSource 
        LoadGrid() 
    End Sub 
 
Protected Sub LoadGrid(Optional ByVal TableName As String = "") 
                 With Me.grdSearchResults 
                    If TableName <> "" Then 
                        .DataSource = SearchResults.Tables(TableName) 
                    Else 
                        .DataSource = SearchResults 
                    End If 
End Sub 


The SearchResults is a DataSet with 3 DataTables

Request is the first DataTable
Columns: ADMRequestID

RequestItems is the next DataTable
Columns: ItemID, ADMRequestID

ClaimItems is the next DataTable
Columns: ItemID, ADMClaimID
Fred
Top achievements
Rank 1
 answered on 11 Aug 2009
2 answers
299 views
Here is a quick summary of the issue that I am currently having... I may be missing something obvious, but I have tried just about everything. 

  1. I have a masterpage that has the windowmanager on it with the following definition:
    <telerik:RadWindowManager ID="adminWindowManager" runat="server" DestroyOnClose="true" Behaviors="Close,Reload,Move" KeepInScreenBounds="true" Modal="true" VisibleStatusbar="false" ShowContentDuringLoad="false" OnClientPageLoad="ClientName.Web.UI.Window.OnWindowLoaded"  /> 
  2. I have an aspx page that has a button that calls another page via radwindow:
    <input type="button" onclick="ClientName.Web.UI.Window.OpenWindow('NewCustomer.aspx','NewCustomer',false);" value="New Customer" />
    Supporting Functions:
    ClientName.Web.UI.Window.Manager = function() { 
        return GetRadWindowManager(); 
    } 
    ClientName.Web.UI.Window.OpenWindow = function(u, t, d, c) { 
        var m = ClientName.Web.UI.Window.Manager(); 
        var w = m.open(u, t); 
        if (d) { w.set_modal(d); } 
        if (c) { w.add_close(c); } 
    }; 
  3. All of this works fine, then on the open aspx page i have a form with a validation summary.  I edited two lines of the validationsummary javascript from msft to show a rad alert instead of modifing the innerhtml of the validationsummary.
  4. This is the function that it calls:
    function ValidationSummaryOnSubmit(validationGroup) { 
    ... 
        ClientName.Web.UI.Window.OpenAlert('Validation HTML Message', 'Validation Error'); 
    ... 
    } 

    Supporting Functions:
    ClientName.Web.UI.Window.GetParent = function() { 
        var w = null; 
        if (window.radWindow) { w = window.radWindow; } 
        else if (window.frameElement.radWindow) { w = window.frameElement.radWindow; } 
        return w.BrowserWindow; 
    } 
    ClientName.Web.UI.Window.OpenAlert = function(m, t) { 
        var c = this; 
        if (typeof radalert == 'undefined') { c = ClientName.Web.UI.Window.GetParent(); } 
        var a = c.radalert(m, 0, 0, t); 
        a.setActive(); // THIS DOES NOT WORK 
        a.add_pageLoad(function(s,a) { ... }); // THIS DOES NOT WORK EITHER 
    }; 

No matter what it try I can't seem to get it to work. At first i thought it was because they are both modal but now the radwindow is not and the radalert is...  I have included a image of my result...

Sample Image   
Marc Messer
Top achievements
Rank 2
 answered on 11 Aug 2009
1 answer
50 views
Hi,
does radeditor possible do saving its content into rtf or word document?  I intend to use radeditor to compose a template and save it either word or rtf document.  Now I can not achieve, may I know what I should do to get around?

Regards,

Duy
Rumen
Telerik team
 answered on 11 Aug 2009
1 answer
105 views
Hi all

after I added the radrotator to my page it worked well on the local host but after I uploaded it to the server, the page takes about 10 minutes to load and finally show me this error:

Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.


if any one can help me, please reply

Thanks


Fiko
Telerik team
 answered on 11 Aug 2009
1 answer
242 views
Dear all,
i am looking to find solution like http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Accordion/Accordion.aspx and i saw one example at help pages to make it as accordion. I need to have button on right that stays at top, and after click goes down and changes css or image (like advanced search accordion panel).
Contents of a panel would be various input controls.

I wonder what would u suggest? Should i make it by using some different controls and then to redirect or should i use panelbar? Performance is most important. I can make this easly buy using asp.net ajax, so if u have some advices it would be nice.

Kind regards,
Vjeran


Fernando
Top achievements
Rank 1
 answered on 11 Aug 2009
1 answer
106 views
Hello Team.

    I have a radgrid which has a usercontrol in the edititemtemplate. In usercontrol I am using AjaxPro.dll which does the serverside validation with Ajax.

 

<telerik:RadScriptBlock ID="RadCodeScrip1" runat="server">

 


 

 

function CheckDuplicateRole(RoleName)

 

{

 

var OldRoleName= document.getElementById('<%= OldRoleName.ClientID %>').value;

 

if(RoleName.value != OldRoleName)

 

{

 

 

 

var isdup=Role.IsDuplicate(RoleName.value);

 

 

 

 

if(isdup.value==true)

 

{

alert(

"Role already Exists");

 

document.getElementById(

'<%= txtRoleName.ClientID %>').value="";

 

 

 

 

}

}

 

}

 

 

</telerik:RadScriptBlock> 

 

 

 

This Code was working until I added RadAjaxManager in the page.
I have added this code under RadScriptBlock but its not working for me


Peter
Top achievements
Rank 1
 answered on 11 Aug 2009
2 answers
346 views
Hi,

I want to execute the following steps in the order mentioned.

1. From a client side function on a modal pop up, call a serve side function on the modal pop up code behind
2. Depending on the bool value returned from the server side function to the client side function the modal pop up may or may not be closed.

Can anyone please help me with this ?
Thanks in advance.
nirmal
Top achievements
Rank 1
 answered on 11 Aug 2009
1 answer
211 views
Hello !

i have a question , is it possible to use strings in radtreeview datasource as id's ?
for example tweaked treeview demo from TreeView / Programmatic Data Binding (doesnt work) :
        
internal class SiteDataItemString
        {
            private string _text;
            private string _id;
            private string _parentId;

            public string Text
            {
                get { return _text; }
                set { _text = value; }
            }


            public string ID
            {
                get { return _id; }
                set { _id = value; }
            }

            public string ParentID
            {
                get { return _parentId; }
                set { _parentId = value; }
            }

            public SiteDataItemString(string id, string parentId, string text)
            {
                _id = id;
                _parentId = parentId;
                _text = text;
            }
        }


        private void BindToIEnumerable(RadTreeView treeView)
        {
           List<SiteDataItemString> siteData = new List<SiteDataItemString>();

            siteData.Add(new SiteDataItemString("1", "0", "Products"));
            siteData.Add(new SiteDataItemString("2", "1", "RadControls for ASP.NET Ajax"));
            siteData.Add(new SiteDataItemString("3", "1", "RadControls for Silverlight"));

            treeView.DataTextField = "Text";
            treeView.DataFieldID = "ID";
            treeView.DataFieldParentID = "ParentID";
            treeView.DataSource = siteData;
            treeView.DataBind();
       }

Thank You !
Veselin Vasilev
Telerik team
 answered on 11 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?