Showing posts with label creating. Show all posts
Showing posts with label creating. Show all posts

Wednesday, March 28, 2012

TreeView and update panel

I am creating a browser for a large document management system, modelled on the way windows explorer works.

So: ... I have a TreeView providing a view of the folders for which I am populating the child nodes on demand when a node is expanded or clicked. (The original method of populating the whole TreeView was impractical since it took several minutes to return and often timeout!)

At the same time, if a node is clicked, I show a list of the documents in that folder.

I can get this working, but somewhere along the way, the client stops working and the TreeView click event stops firing.

Is this a known issue or do you think I am asking too much of the framework?

I have since abandonded Atlas for this and am currently living with a long blank screen between page refreshes, which I think is totally useless for user experience.

Sorry not an immediate answer, but I would also be interested in anybody else's take on this.

I will trying to build more or less the same thing over the next couple of days (for an online content management system) so I'll get back to you then on it (successful or not!), but no I don't think it's asking too much, it's a perfectly logical use of it!


Coming back to this post.. .

How have you implemented the TreeView - just that it is supposed to implement client call back as part of the control so you shouldn't need to have blank screens and whole page refreshes - possibly a pause before expanding if it's big - but no blank screens?

I've just dropped it into my content management system, and while it's not pure Atlas, it seems to work fine using the client call back? Probably I'm missing something as only just started playing with Atlas.

Wednesday, March 21, 2012

Trouble creating ReorderList in codebehind

All,

I am trying to create a ReorderList in the codebehind for a page and am having a rediculous amount of trouble. When I set AllowReorder to 'false' the page displays what it should, but when i set AllowReorder to 'true' I get "Object reference not set to an instance of an object. " on the line where I am doing the databinding. I am using an SqlDataAdapter which implements both SelectCommand and UpdateCommand

This is my first time trying to set one of these up, so i think there is a good chance that I am missing something simple. I am copying and pasting in my code if that helps.

---begin code-----

1using System;2using System.Data;3using System.Configuration;4using System.Web;5using System.Web.Security;6using System.Web.UI;7using System.Web.UI.WebControls;8using System.Web.UI.WebControls.WebParts;9using System.Web.UI.HtmlControls;10using AjaxControlToolkit;11using System.Text;12using System.Data.SqlClient;1314public partialclass _Default : System.Web.UI.Page15{16protected void Page_Load(object sender, EventArgs e)17 {18 SqlConnection conn =new SqlConnection(ConfigurationManager.ConnectionStrings["GLISurveyGenerator_3"].ConnectionString);19 SqlDataAdapter dataadapter =new SqlDataAdapter();2021 SqlCommand selectcommand =new SqlCommand();22 selectcommand.CommandText="spGetPagesForSurvey";23 selectcommand.CommandType = CommandType.StoredProcedure;24 selectcommand.Parameters.Add("@dotnet.itags.org.SurveyID", SqlDbType.Int, 32).Value = 1;25 selectcommand.Connection = conn;2627 SqlCommand updatecommand =new SqlCommand();28 updatecommand.CommandText ="spUpdatePagesForSurvey";29 updatecommand.CommandType = CommandType.StoredProcedure;30 updatecommand.Parameters.Add("@dotnet.itags.org.SurveyPageID", SqlDbType.Int, 32);31 updatecommand.Parameters.Add("@dotnet.itags.org.SurveyPageNumber", SqlDbType.Int, 32);32 updatecommand.Connection = conn;3334 dataadapter.SelectCommand = selectcommand;35 dataadapter.UpdateCommand = updatecommand;3637 DataSet ds1 =new DataSet();3839 dataadapter.Fill(ds1);4041 ReorderList reorderlist =new ReorderList();42 reorderlist.ID ="RL1";43 reorderlist.AllowReorder =true;44 reorderlist.PostBackOnReorder =true;45 reorderlist.EnableViewState =false;46 reorderlist.ShowInsertItem =false;47 reorderlist.ItemTemplate =new pagereorderitemtemplate();48 reorderlist.ReorderTemplate =new pagereorderreorderitemtemplate();49 reorderlist.DragHandleTemplate =new pagereorderhandletemplate();50 reorderlist.EmptyListTemplate =new pagereorderemptytemplate();51 reorderlist.DataKeyField ="SurveyPageID";52 reorderlist.SortOrderField ="SurveyPageNumber";53 reorderlist.ShowInsertItem =false;5455 reorderlist.DataSource = ds1;56 reorderlist.DataBind();575859 contentholder.Controls.Add(reorderlist);60 }6162void reorderlist_UpdateCommand(object sender, ReorderListCommandEventArgs e)63 {64throw new Exception("The method or operation is not implemented.");65 }6667private class pagereorderitemtemplate : ITemplate68 {69public void InstantiateIn(System.Web.UI.Control container)70 {71 Literal lc =new Literal();72 lc.DataBinding +=new EventHandler(lc_DataBinding);73 container.Controls.Add(lc);74 }7576void lc_DataBinding(object sender, EventArgs e)77 {78 Literal lc;79 lc = (Literal)sender;80 ReorderListItem item = (ReorderListItem)lc.NamingContainer;81string dataitem = DataBinder.Eval(item.DataItem,"SurveyPageTitle").ToString();82 lc.Text = dataitem;83 }84 }8586private class pagereorderreorderitemtemplate : ITemplate87 {88public void InstantiateIn(System.Web.UI.Control container)89 {90 Literal lc =new Literal();91 lc.Text ="test2";92 container.Controls.Add(lc);93 }94 }9596private class pagereorderhandletemplate : ITemplate97 {98public void InstantiateIn(System.Web.UI.Control container)99 {100 Literal lc =new Literal();101 lc.Text ="| |";102 container.Controls.Add(lc);103 }104 }105106private class pagereorderemptytemplate : ITemplate107 {108public void InstantiateIn(System.Web.UI.Control container)109 {110 Literal lc =new Literal();111 lc.Text ="empty";112 container.Controls.Add(lc);113 }114 }115}

--end code--

I know most of the templates don't contain all that they should, I just wanted to put something in them so they at least existed. If anyone has any suggestions on how I can get around this error, I would greatly appreciate it.

-madrak

I have been able to pin down the error a little further. The reorderlist works with an sqldatasource that is created in the .aspx page using the following code

1"SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:GLISurveyGenerator_3 %>"2 SelectCommand="SELECT [SurveyPageID], [SurveyPageTitle], [SurveyPageNumber] FROM [tblSurveyPages] WHERE ([SurveyID] = @.SurveyID) order by [SurveyPageNumber]" UpdateCommand="Update [tblSurveyPages] set [SurveyPageNumber] = @.SurveyPageNumber, [SurveyPageTitle] = @.SurveyPageTitle where [SurveyPageID] = @.SurveyPageID">34 "1" Name="SurveyID" Type="Int32">567 "SurveyPageID" Type="Int32">8 "SurvePageTitle" Type="Int32">9 "SurveyPageNumber" Type="Int32">1011

but does not work with the sqldatasource as created in the prior post, anyone have any ideas?


Hi,

I removed reorderlist.DataBind(); and add page.DataBind();. Now I am able to display the data, but unable to reorder the items in the list

- narendra


Hi,

I have the same problem :(

Have anyone solved it?

Trouble getting AJAX Extension 1.0 to work in VWD

I have installed the ASP.NET 2.0 AJAX Extension 1.0 on my computer. I tried creating an AJAX enabled web application in Visual Web Developer and the UpdatePanel controls along with all the other new AJAX keywords were not recognised even though the toolbox had been updated with the controls. I thought it might be my errors in the code, so I downloaded the sample code for the ToDo list application tutorial onwww.asp.net/ajax and I had the same problem.

That way I can be sure that it is my computer! I have Microsoft .NET Framework 1.0, 1.1, 2.0 and 3.0 installed. I have tried a reinstall of AJAX Extension 1.0 and have made sure that I have selected 'AJAX Enabled project' at the start up screen.

What is the problem?

Check out this link

http://asp.net/AJAX/Control-Toolkit/Live/Walkthrough/Setup.aspx



Sorry but that really wasn't that helpful! I just have the AJAX Extensions 1.0 NOT The Control Toolkit. I can't get the first bit to work so I can't use the toolkit anyway! When I tried installing the vsi file for the toolkit it didn't install the components properly.

What is the problem?


I think because you r using VWD, you will not be able to install vsi template.

and to use Microsoft AJAX Control you will have to download the toolkit

After downloading the toolkit just follow steps from above link

in "Configure Visual Studio 2005 and Visual Web Developer" section

I hope it helps.


I realised the problem.

I needed to install Service Pack 1 for VWD before it would fully recognise the AJAX Extensions. That solved it and I could then install the control toolkit