Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
125 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
256 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
226 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
256 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
146 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
0 answers
121 views
Ok i need to download data feed file (XML) and it works fine except that i cannot show up the progress bar.

WebClient client = new WebClient(); 
client.DownloadFile(@"http://feed.sitename.com/page.aspx?param=value", System.IO.Path.Combine(Server.MapPath("~"), "latestdata.xml")); 
client.Dispose(); 

What rad ajax controls i need to use in order to display the progress and where to place my code?

Thanks



El
Top achievements
Rank 1
 asked on 10 Aug 2009
1 answer
285 views
Hi,

I added an image button into a radgrid but i dont want it to do anything therefore I would like to find out if we can disable the click. I want users to see the image not click it.

Thanks
Shinu
Top achievements
Rank 2
 answered on 10 Aug 2009
3 answers
193 views
I would like to do something similar to the "Load on Demand" and "First Look" example.  I have several asp:LinkButton's  .  Onmouse over, I would like to load a user control.  Does anyone have an example of how to do this not using the code behind.  I am not loading data from a DB.  I seems that all the examples say its possible to put the information inline, but when I view the actual code, all the examples use code behind and load from a DB.  Anyone??
Svetlina Anati
Telerik team
 answered on 10 Aug 2009
1 answer
593 views

The following code (called from RadGrid_PreRender) will iterate through a radgrid (and 3 nested tables) and hide the expand button if the row has no child records. I pieced this together from samples on this forum.

1) The MasterTableView is first populated by a call to NeedDataSource
2) The rows for the related nested tables are called by the DetailTableDataBind method
3) HierarchyLoadMode="ServerOnDemand" for all 4 tables ("Client" is not acceptable due to number of records)

 

 

 

Now, the last 3 lines of code (below, currently commented out) will collapse the MasterTableView nicely. However, upon expanding a row from that MasterTableView, the nested tables within are all expanded - not collapsed - as I need them to be. 

I have exhausted so many possibilities, so I finally posted this here. Note: This is not a question of how to hide the expand column (as is discussed in previous posts). Rather, it is a matter of making already collapsed tables STAY collapsed when the MasterTableView is expanded.

I suspect the problem lies within the DetailTableDataBind being called by ServerOnDemand after the MasterTableView row is clicked (thusly, repopulating the tables and overwriting any hiding/collapsing that has already been perfomed). Basically, I really need to know how to call "HideExpandColumnRecursive" on NESTED detail tables after they are created (which happens after a MasterTableView has been expanded). Complicated, I know. Any help would be greatly appreciated.

 

Protected

 

Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As EventArgs)

 

 

If Not IsPostBack Then

 

 

 

HideExpandColumnRecursive(RadGrid1.MasterTableView)

 

 

End If

 

 

End Sub

 

 

 

Public

 

Sub HideExpandColumnRecursive(ByVal tableView As GridTableView)

 

 

Dim nestedViewItems As GridItem() = tableView.GetItems(GridItemType.NestedView)

 

 

For Each nestedViewItem As GridNestedViewItem In nestedViewItems

 

 

For Each nestedView As GridTableView In nestedViewItem.NestedTableViews

 

 

If nestedView.Items.Count = 0 Then

 

 

Dim cell As TableCell = nestedView.ParentItem("ExpandColumn")

 

 

Dim expandCollapseButton As Button = CType(cell.Controls(0), Button)

 

expandCollapseButton.Visible =

False

 

nestedViewItem.Visible =

False

 

 

End If

 

 

If nestedView.HasDetailTables Then

 

HideExpandColumnRecursive(nestedView)

 

End If

 

 

Next

 

 

Next

 

 

'For Each item As GridDataItem In RadGrid1.MasterTableView.Items

 

 

' item.Expanded = False

 

 

'Next

 

 

End Sub

 

Mira
Telerik team
 answered on 10 Aug 2009
3 answers
97 views
Hello all,
I have one problem with Date Picker Telerik Control that after selecting date, cursor is not focused properly to the corresponding textbox.

Thanx for any kind of help.

Regards,
Nirav
nirav
Top achievements
Rank 1
 answered on 10 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?