Showing posts with label datagrid. Show all posts
Showing posts with label datagrid. Show all posts

Wednesday, March 28, 2012

ajax beta 2, treenode collapsing?

Greetings,

I downloaded and im using the ajax tookit 2. I have a problem with putting a treeview in a datagrid and getting it to work properly. I found other threads on this issue (mainly when navagating to other pages), but none of them seemed to address (or at least address and provide a solution for) the problem I have. Here is the issue.

I have a treeview with nodes that post back. On the post back, I simply collapse the node if its expanded and vice versa. It works good outside of an updatepanel, but when I put it inside an updatepanel, the expanded state does not save. Is there a simple solution? Is there someway I can call the javascript that the +/- control uses (so I dont have to expand/collapse in the code)?

Heres some code to show you my simple example

<%

@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>

<%

@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

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

<

headrunat="server"><title>Untitled Page</title>

</

head>

<

body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"/><div> <asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate> <br/><asp:TreeViewID="TreeView"runat="server"OnSelectedNodeChanged="select2"><Nodes><asp:TreeNodeText="New Node1"Value="New Node11"Expanded="False"><asp:TreeNodeText="New Node12"Value="New Node12"></asp:TreeNode></asp:TreeNode><asp:TreeNodeText="New Node2"Value="New Node2"Expanded="False"><asp:TreeNodeText="New Node21"Value="New Node21"><asp:TreeNodeText="New Node22"Value="New Node23"></asp:TreeNode></asp:TreeNode></asp:TreeNode><asp:TreeNodeText="New Node31"Value="New Node31"Expanded="False"><asp:TreeNodeText="New Node32"Value="New Node32"><asp:TreeNodeText="New Node33"Value="New Node33"></asp:TreeNode></asp:TreeNode></asp:TreeNode><asp:TreeNodeText="New Node4"Value="New Node4"Expanded="False"></asp:TreeNode><asp:TreeNodeText="New Node5"Value="New Node5"Expanded="False"></asp:TreeNode></Nodes></asp:TreeView><br/> </ContentTemplate></asp:UpdatePanel></div> <br/><br/></form>

</

body>

</

html>

-------------------

using

System;

using

System.Data;

using

System.Configuration;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

public

partialclass_Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

}

protectedvoid select2(object sender,EventArgs e)

{

TreeNode selected = TreeView.SelectedNode;if ((bool)selected.Expanded)

{

selected.Collapse();

}

else

{

selected.Expand();

}

selected.Selected =

false;

}

}

While we work closely with the ASP.NET AJAX team when developing the Toolkit, they're the real experts on general ASP.NET AJAX issues. Your problem doesn't seem to be directly related to the Toolkit, so we'd appreciate if you considered posting to one of theother newsgroups such asAJAX Discussion and Suggestions. Your post will be more helpful to others looking for similar advice if it's in the right place. Thank you!

Saturday, March 24, 2012

Ajax and VS 2003 Datagrid

Hi everyone

I am learning Ajax and I wanted to use it with VS 2003 to make an editable datagrid. Can I use .net datagrid and ajax together in VS 2003. Please help me here, I would appreciate if I can get some links too that I can see them to learn.

Thanks

-Sarah

ASP.NET Ajax 1.0 was meant for ASP.NET 2.0 and up, so you may not be able to use older than 2.0 controls. You may be able to get something to work if you follow the section of "Using ASP.NET Ajax Without Visual Studio" onthis page.