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

My combobox is inside a TableCell which has a 50% width, I tried to set the combobox with to 100% using the attribute and it doesn't work ? I get a smal combobox which occupy 20% of my cell ?
When I suppress the width att, I et normal default width
Am I misbehaving somewhere or is tehre a Pb?

Thanks for help.
CS
Helen
Telerik team
 answered on 10 Aug 2009
4 answers
222 views

I am trying to databind a rad tree to a table that I create from a database. I followed the video example and changed the way I populate the table, but I know I am getting the correct data back. However, I get this error

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 14:         
Line 15: ' CreateChildControls the Table and assign the datasource
Line 16: RadTreeView1.DataSource = CreateTable()
Line 17: ' Assign the data fields
Line 18: RadTreeView1.DataFieldID = "ID"

Source File: c:\websites\ClickableCommunity\ClickableCommunity.Master    Line: 16

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
ASP.clickablecommunity_master.Page_Load(Object sender, EventArgs e) in c:\websites\ClickableCommunity\ClickableCommunity.Master:16
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

Here is the vb code

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        
        If Not Page.IsPostBack Then
        
            ' CreateChildControls the Table and assign the datasource
            RadTreeView1.DataSource = CreateTable()
            ' Assign the data fields
            RadTreeView1.DataFieldID = "ID"
            RadTreeView1.DataFieldParentID = "ParentID"
            RadTreeView1.DataTextField = "Text"
            ' Bind the data
            RadTreeView1.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 = 0
        
        '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, count.ToString, 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

What I can't understand is why it says that createtable is null. I am returning the table and I have outputted the data that I am adding to the table. Any ideas? Thanks

Veselin Vasilev
Telerik team
 answered on 10 Aug 2009
7 answers
183 views
Hi there

I'm having a little layout issue regarding the ImageUrl property on a root item in the RadMenu.
Whenever I add an image, the hover style breaks the background image, displaying a 3px space between the image and the text.

Take a look here: http://img195.imageshack.us/img195/2366/radmenuimageurl.png

I can see that the problem is because of the image tag being placed outside the span containing the text for the button. If I (using FireBug) moves the image tag inside the span element of the button, it renders correctly.

Any ideas?
Kamen Bundev
Telerik team
 answered on 10 Aug 2009
1 answer
55 views
This does not work with Opera (cookies allowed set to true). Anyone see this and know id there is a bug fix? http://demos.telerik.com/aspnet-ajax/panelbar/examples/functionality/persiststateincookie/defaultcs.aspx
Helen
Telerik team
 answered on 10 Aug 2009
23 answers
493 views
Hi,

I tried surrounding the rsAvOptionsScroll div in the AdvancedForm with a UpdatePanel:

        <asp:UpdatePanel ID="updtAdvFormControls" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
        <ContentTemplate>

Then I tried dropping a standard Button and a RadTextBox on the form:

        <asp:Button ID="btnResetSearch" runat="server" Text="Reset" OnClick="AddTeamMember2" Style="text-align: center;" />

        <telerik:RadTextBox ID="RadTextBox1" runat="server">
        </telerik:RadTextBox>

After that I created the callback function:

        protected void AddTeamMember2(object sender, EventArgs e)
        {
            RadTextBox1.Text = "hhh";
            updtAdvFormControls.Update();
        }

When I clicked on the button the debugger goes into the AddTeamMember2 function
but the RadTextBox1 never gets set to "hhh" after it you hit F5 to continue. If I type in
"xxx" in the RadTextBox1 from the screen and then take the debugger back into the
AddTeamMember2 function, the value is set to "xxx" and latter gets set to "hhh" but
after hitting F5 to continue the screen always says "xxx".

 

Thanks,

Kip

Peter
Telerik team
 answered on 10 Aug 2009
1 answer
128 views
Hi All,

Is there any way to select the empty message of a combo box on the client side. I've tried using the clearSelection() method, but it seems to clear to combox box selection.

Any help!!!

Thanks in advance.

Haroon
Veselin Vasilev
Telerik team
 answered on 10 Aug 2009
3 answers
268 views
How do I remove the vertical scrollbar from the monthly view of the radscheduler? Thanks for your help.
Veselin Vasilev
Telerik team
 answered on 10 Aug 2009
1 answer
236 views
Hi all,

i stick a little bit with realizing a common usecase. I hope someone can give me a short instruction about what to do.
We need to create Controls dynamically using AJAX / without full page submits.

A simple example would be the following:
We have a regular ASP-Button inside an other control. When someone click the button there should start an AjaxRequest to the CodeBehind Class. The method in the CodeBehind Class should generate a new RadComboBox with data from an XML-File and place the RadComboBox in the parent Control. Of course, when the AJAX Request finished the RadComboBox should be displayed in the Client, but without rerendering the hole RadPane. Using a PlaceHolder is also no Option because i dont know how much Controls i need. And placeing all of them in the same PlaceHolder which is connected by RadAjaxManager means that all new Controls in the PlaceHolder will be rerendered when i update the PlaceHolder. Also the dynamic created Controls are NOT persistent. Its hard to realize that. That means I've to recreate them on each PageLoad / Partial Load of the Parent.

Isn't it possbile to create a Control, which is persistent like if I have create it declarativly?


Building a RadComboBox and fill it with XML is also no problem.
I cant define the Controls declaratively and just  hide/show them, because we dont know which kind of control the user will choose.
Using the RadAjaxManager also doesnt work in my tests because wasn't able to tell him the ID of the TargetControlID to rerender (because it soes not exist at the moment). Rerender the surrounding Control was also not as good as we expected, because it contains much other controls which should not rerender.....

Does someone have a suggestion for me ?

Thank you

ragards

Alex
Georgi Krustev
Telerik team
 answered on 10 Aug 2009
4 answers
267 views
Hello,

I need to rebind my grid when a sort command is called by the user. I tried the OnSortCommand event but that does not fire server side when a column is sorted by the user. The problem is the page load is called again on sort meaning I need to rebind my grid when this happens.

I am using AJAX and advanced data binding on the grid. Is there anyway to rebind a grid when a sort link is clicked on a grid?

Hope that makes sense.

Thanks,

Michael
Nikolay Rusev
Telerik team
 answered on 10 Aug 2009
0 answers
152 views
Hi,
I have used "TreeNodeExpandMode.ServerSideCallBack" mode in ExpandMode of each nodes being added as child note but these chile nodes are not populated while expanding a root node.
How can I fix this problem.
However if I use "TreeNodeExpandMode.ServerSide" as Expand mode in my chile nodes, it works perfectly.

Following is my code to fill TreeView nodes
------------------------------------------------------------------------------------------
Code behind file code
-------------------------------------------------------------------------------------------

using

 

System;

 

using

 

System.Collections;

 

using

 

System.Configuration;

 

using

 

System.Data;

 

using

 

System.Linq;

 

using

 

System.Web;

 

using

 

System.Web.Security;

 

using

 

System.Web.UI;

 

using

 

System.Web.UI.HtmlControls;

 

using

 

System.Web.UI.WebControls;

 

using

 

System.Web.UI.WebControls.WebParts;

 

using

 

System.Xml.Linq;

 

using

 

System.Data.SqlClient;

 

using

 

Telerik.Web.UI;

 

namespace

 

MasterWeb35

 

{

 

 

public partial class WebFormDB : System.Web.UI.Page

 

{

 

protected void Page_Load(object sender, EventArgs e)

 

{

 

RadTreeNode rootNode = null;

 

 

DataTable dTAllData = null;

 

 

 

try

 

{

 

if (!Page.IsPostBack)

 

{

 

int iLevel = 1;

 

 

int iParentNodeID = 0;

 

dTAllData = GetInitialData(iLevel, iParentNodeID);

 

/*

 

oNodeMenu = new RadContextMenu();

oNodeMenu.Items.Add(new RadMenuItem("Add"));

oNodeMenu.Items.Add(new RadMenuItem("Edit"));

rootNode.Controls.Add(oNodeMenu);

*/

 

/*RadTreeNode rootNode = new RadTreeNode("Root Item");

 

rootNode.Value = "1";

rootNode.Expanded = true;

rootNode.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;

RadTreeView1.Nodes.Add(rootNode);*/

 

/*RadTreeView1.DataSource = dTAllData;

 

RadTreeView1.DataTextField = "AILevel1Name";

RadTreeView1.DataValueField = "AILevel1ID";

RadTreeView1.DataBind();*/

 

for (int i = 0; i < dTAllData.Rows.Count; i++)

 

{

rootNode =

new RadTreeNode(dTAllData.Rows[i]["NodeLevel"].ToString());

 

rootNode.Value = dTAllData.Rows[i][

"IDValue"].ToString();

 

rootNode.Expanded =

true;

 

rootNode.ExpandMode =

TreeNodeExpandMode.ServerSideCallBack;

 

RadTreeView1.Nodes.Add(rootNode);

}

}

}

 

catch(Exception ex)

 

{

Response.Write(ex.Message +

Environment.NewLine + ex.StackTrace);

 

}

 

finally

 

{

rootNode =

null;

 

}

}

 

public DataTable GetInitialData(int iLevel, int iparentNodeID)

 

{

 

SqlConnection oCon = null;

 

 

SqlDataAdapter oSqlAdapter = null;

 

 

DataSet dsData = null;

 

 

DataTable dTAllData = null;

 

 

 

try

 

{

oCon =

new SqlConnection("myconnectionString")

 

oCon.Open();

 

if (oCon.State == ConnectionState.Open)

 

{

Response.Write(

"Connected to DB");

 

}

dsData =

new DataSet();

 

oSqlAdapter =

new SqlDataAdapter();

 

 

SqlCommand oSqlCommand = new SqlCommand();

 

oSqlCommand.Connection = oCon;

oSqlAdapter.SelectCommand = oSqlCommand;

oSqlAdapter.SelectCommand.CommandText =

"usp_GetNodes";

 

oSqlAdapter.SelectCommand.CommandType =

CommandType.StoredProcedure;

 

oSqlAdapter.SelectCommand.Parameters.AddWithValue(

"@level", iLevel);

 

oSqlAdapter.SelectCommand.Parameters.AddWithValue(

"@NodeID",iparentNodeID);

 

oSqlAdapter.Fill(dsData);

 

if (dsData.Tables.Count > 0)

 

{

dTAllData = dsData.Tables[0];

}

}

 

catch(Exception ex)

 

{

Response.Write(ex.Message+

Environment.NewLine+ex.StackTrace);

 

}

 

finally

 

{

oCon =

null;

 

oSqlAdapter =

null;

 

dsData =

null;

 

 

}

 

return dTAllData;

 

}

 

protected void RadTreeView1_NodeExpand(object sender, RadTreeNodeEventArgs e)

 

{

 

RadTreeNode rootNode = null;

 

 

String sNodeIdVal = "";

 

 

String[] sValues = null;

 

 

int intParentNodeID = 0, intLevelID = 0;

 

 

DataTable dTAllData = null;

 

 

try

 

{

sNodeIdVal = e.Node.Value;

sValues = sNodeIdVal.Split(

",".ToCharArray());

 

intParentNodeID =

Convert.ToInt32(sValues[0]);

 

intLevelID =

Convert.ToInt32(sValues[1]);

 

intLevelID = intLevelID + 1;

 

if (intLevelID <= 3)

 

{

dTAllData = GetInitialData(intLevelID, intParentNodeID);

 

if (dTAllData.Rows.Count > 0)

 

{

 

for (int i = 0; i < dTAllData.Rows.Count; i++)

 

{

rootNode =

new RadTreeNode(dTAllData.Rows[i]["NodeLevel"].ToString());

 

rootNode.Value = dTAllData.Rows[i][

"IDValue"].ToString();

 

rootNode.Expanded =

true;

 

rootNode.ExpandMode =

TreeNodeExpandMode.ServerSideCallBack;

 

rootNode.Text = dTAllData.Rows[i][

"NodeLevel"].ToString();

 

e.Node.Nodes.Add(rootNode);

}

e.Node.Expanded =

true;

 

}

}

}

 

catch (Exception ex)

 

{

Response.Write(ex.Message+

Environment.NewLine+ex.StackTrace);

 

}

 

finally

 

{

dTAllData =

null;

 

sValues =

null;

 

}

}

 

private DataTable CreateDataTableForLevel1()

 

{

 

DataTable dTLevel1 = new DataTable();

 

dTLevel1.Columns.Add(

"ID");

 

dTLevel1.Columns.Add(

"Name");

 

dTLevel1.Columns.Add(

"ParentID");

 

 

String[] Row1 = new String[] { "1", "GrandPa", "0" };

 

dTLevel1.LoadDataRow(Row1,

true);

 

 

return dTLevel1;

 

}

 

private DataTable CreateDataTableForLevel2()

 

{

 

DataTable dTLevel2 = new DataTable();

 

dTLevel2.Columns.Add(

"ID");

 

dTLevel2.Columns.Add(

"Name");

 

dTLevel2.Columns.Add(

"Level1ID");

 

 

String[] Row1 = new String[] { "4", "Father", "1" };

 

dTLevel2.LoadDataRow(Row1,

true);

 

 

return dTLevel2;

 

}

 

private DataTable CreateDataTableForLevel3()

 

{

 

DataTable dTLevel3 = new DataTable();

 

dTLevel3.Columns.Add(

"ID");

 

dTLevel3.Columns.Add(

"Name");

 

dTLevel3.Columns.Add(

"Level2ID");

 

 

String[] Row1 = new String[] { "1", "My brother", "4" };

 

 

String[] Row2 = new String[] { "2", "Me", "4" };

 

dTLevel3.LoadDataRow(Row1,

true);

 

 

return dTLevel3;

 

}

}

}

------------------------------------------------------------------------------------------
HTML Code
-------------------------------------------------------------------------------------------

 

<

 

form id="form1" runat="server">

 

 

 

 

 

 

<asp:ScriptManager ID="smScriptManager" runat="server"></asp:ScriptManager>

 

 

 

 

 

 

<telerik:RadTreeView ID="RadTreeView1" runat="server" OnClientContextMenuShowing="onClientContextMenuShowing" Height="800px" Width="600px" wStyle="border: 1px solid #CBE7F5;"

 

 

 

 

 

 

OnNodeExpand="RadTreeView1_NodeExpand">

 

 

 

 

 

 

<ContextMenus>

 

 

 

 

 

 

<telerik:RadTreeViewContextMenu ID="cMenu" runat="server" CausesValidation="true" EnableEmbeddedScripts="true">

 

 

 

 

 

 

<Items>

 

 

 

 

 

 

<telerik:RadMenuItem Text="Add" Value="1" />

 

 

 

 

 

 

<telerik:RadMenuItem Text="Delete" Value="2"/>

 

 

</Items>

 

 

 

 

 

 

</telerik:RadTreeViewContextMenu>

 

 

 

 

 

 

</ContextMenus>

 

 

 

 

 

 

</telerik:RadTreeView>

 

 

</form>

 

Arindam Tewary
Top achievements
Rank 1
 asked on 10 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?