.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Creating Reorderlist Programmatically

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

I hope to get some guidance on how to create reorder lists programmatically because of the situation described below. Thank you.

I have a page where I want to have a toDo Iist for each of several (typically 10) milestone categories. I can think of 3 options.

I don't know in advance how many 'active' categories there will be but I there is a known fixed total of about 20  categories, of which from 1 to 20 may be 'active'

1. Have one Master ReOrderList And Then Nest the Category ReorderLists Inside 

2. Create the reorderlists programmatically.

3. Brute force approach. Hardcode all 20 reorderlists and their associated sqldatasources, and then set visibility

depending on which category is active. This approach is the simplest but has the disadvantage of too much

repetitive code and the reorder lists would be in a fixed order, when I really want them to match the category order.




View Complete Post

More Related Resource Links

Creating an Excel Spreadsheet programmatically using VB.NET

The Interoperability services make it very easy to work with COM Capable Applications such as Word and Excel. This article reveals using Excel from a managed application. Excel is the spreadsheet component of Microsoft Office 2000. The majority of Excel programmatic functionality is exposed through Automation via the type library Excel9.olb. The intention of this article is to express that a managed application can interrelate with Excel as a COM server.

Creating an Excel Spreadsheet and Adding Data to It Programmatically

The Interoperability services make it veryeasy to work with COM Capable Applications such as Word and Excel. Thisarticle reveals using Excel from a managed application. Excel is thespreadsheet component of Microsoft Office 2000. The majority of Excelprogrammatic functionality is exposed through Automation via the typelibrary Excel9.olb. The intention of this article is to express that amanaged application can interrelate with Excel as a COM server.

Programmatically creating a SharePoint Site based on user input


I am working on developing a “Create Website Wizard” for SharePoint 2007 that would do the following (I am simplifying a little for the sake of this post):


1.      Take user input as follows:



Product Code:

Category (I, II, III):

The category will be a choice field (radio buttons or a dropdown)

Error when creating site collection through programmatically?

hi all, When i am creating SharePoint Site collection through programmatically i am getting an error message. i am using below code...   using (SPSite site = new SPSite("http://servername:7853/")) {   using (SPWeb web = site.OpenWeb()) {   SPWebApplication oweb = web.Site.WebApplication; site.AllowUnsafeUpdates = true;   SPSiteCollection sitecol = oweb.Sites;   SPSite site1 = oweb.Sites.Add("sites/DemoSiteCol", "DemoSiteCol", "Welcome to the Client SiteCol",1033, "STS#0", "Domian\\user", "display name", "user@domian.com");//here i am getting the error message as "Object refernce not set to an instance of an Object". oweb.Update(); } Please tell me why i am getting the error message.... thanks in advance.....

Creating SSIS Package Variables Programmatically

Hi There, I am fairly new to SSIS.  I am creating a number of custom SSIS Tasks that I want to be able to share information between at runtime.  I figured that the best way to do this was through package variables, as in the Execute() method each custom task has access to the package variables through the VariableDispenser object.  I have managed to read variables at runtime that I create in the designer, however I am having trouble creating and writing to them.  I have created a very simple custom task below that I would expect to create the specified variable... [DtsTask(DisplayName = "TestVariableWriter")] public class Variab : Task { public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, object transaction) { try { string varName = "TestVariable"; string varValue = "TestValue"; Variables vars = null; variableDispenser.LockForWrite(varName); variableDispenser.GetVariables(ref vars); if (variableDispenser.Contains(varName)) vars[varName].Value = varValue; else vars.Add(varName, false, string.Empty, varValue); vars.Unlock(); return DTSExecResult.Success; } catch (Exception ex) {

Programmatically creating a cross list XsltListViewWebPart

Hi, Does anyone know how to create a cross list XsltListViewWebPart in code? I can create a XsltListViewWebPart for a single list no problem. But if I don't set the ListId property and set the DataSourceMode to  SPDataSourceMode.CrossList I always get the error "Microsoft.SharePoint.WebPartPages.WebPartPageUserException : List View Web Part could not be added, list may be hidden.". I can't find much documentation on it. Does anyone have an idea how to get this to work? Thanks a lot,   Dan

Creating calendar view from tasks list programmatically

Hi All, I have a Tasks list of type "107" and I am trying to create a Calendar view for the tasks list. The way I created the calendar view is as follows: SPView calView = l.Views.Add("Calendar", l.GetView(l.DefaultView.ID).ViewFields.ToStringCollection(), string.Empty, (uint)100, true, false, SPViewCollection.SPViewType.Calendar, false);<br/><br/> I would like to specify the Time interval, Calendar columns, Default scope for this view. Can anyone point me to documentation for creating a calendar view from tasks list? Do I need to specify that in the viewquery?Thanks.

creating new item in form library programmatically


Hi all,

I have a form library with infopath form published in it. I am trying to create a new item programmatically in it which will contain a instance of the published infopath form. But its suggesting me to use SPFileCollection.Add() for that.


Can anyone show me some light how I can meet my requirement?



Creating a dynamic site using custom template programmatically.



I have sites like




I have created Project1 as Template (Save as Template) and this template is available at http://kashyap Site Gallery > Solutions

http://kashyap/Team has a list called projects. I want to do custom workflow which is run by user manually(It is not problem). I want to create site programmatically  based on the template. I did some code Its

 private void codeCreateSite_ExecuteCode(object sender, EventArgs e)
      SPWeb web = workflowProperties.Web;

      SPListItem lst = workflowProperties.Item;
      string title = lst["Project Title"].ToString();
      string url = Common.UrlString(title);
      string desc = "Project from " + Common.GetFormatedValue(Convert.ToString(lst["Customer"

Programmatically creating a Person or Group type field Textbox (similar to 'Assigned To' field in Ta


In our ASP.NET application created with SharePoint object model, we have a user interface with a Contact Person TextBox, we want this TextBox to be similar to the “Assigned To” filed in out-of-the-box Task List where you can search for a particular site user by typing in his/her name. How can we achieve this functionality programmatically?

Thanks in advance………

Creating Custom Control by Inherits BindingNavigator - How to Add ToolStripItem Programmatically


I'm creating a custom control which inherets the BindingNavigator.

I need do add one ToolStripButton at specific posistion (9 element) on the ToolStrip of the BindingNavigator.

So, I wrote the following code:

 tsb As
 .Name = "BindingNavigatorUndoChanges"

 .Image = My
 .ToolTipText = "Undo changes"


.Items.Insert(9, tsb)

My question is: In which event of the custom control should I put this code?

Many thanks for any kind of help.


Getting an error while creating sitecollection programmatically.



 I am getting an error when i am trying to create a sitecollection programmatically.

"Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown"

at this line ----------->

//Site collection creation

service.CreateSite(siteURL, companyName, companyName, 1033, templateName, ownerName, ownerLogin,


Log file...

Leaving Monitored Scope (ExecuteWcfOperation:http://schemas.microsoft.com/sharepoint/taxonomy/soap/IMetadataWebServiceApplication/GetServiceSettings). Execution Time=25037.1331659474 
10/06/2010 11:22:59.64  w3wp.exe (0x0E74)                        0x1E68 SharePoint Foundation          Monitoring                     b4ly High     Leaving Monitored Scope (Proxy Channel call for Enterprise Metadata Service). Execution Time=25037.7769033025 
10/06/2010 11:22:59.64  w3wp.exe (0x0E74)                        0x1E68 SharePoint Serv

SPFeatureReceiver: Creating report viewer web part programmatically


I have a feature that adds a report viewer web part (SP integrated mode) into the newly created site page.

Problem: The feature activates without any problem through the UI, but I cannot activate it through STSADM (which will be the case when going to production).

Here is my code block that adds the web part to the page. This code block exists in FeatureActivated:

Assembly currentAssembly = Assembly.GetExecutingAssembly();
string dwpStr = string.Empty;

    using (Stream resourceStream = currentAssembly.GetManifestResourceStream("Report.dwp"))
        using (StreamReader sr = new StreamReader(resourceStream))
            dwpStr = sr.ReadToEnd();
            dwpStr = string.Format(dwpStr, web.Url);

    using (StringReader sr = new StringReader(dwpStr))
        string err = string.Empty;
        System.Web.UI.WebControls.WebParts.WebPart wp = wpMan.ImportWebPart((XmlReader.Create(sr as TextReader)), out err); //Exception thrown from this line
        wpMan.AddWebPart(wp, "HeaderZone", 0);
catch (Exception ex)
    //Log errors
Report.dwp is as follows:
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&q

Programmatically creating a package with a SAP .NET data provider: AcquireConnections fails


I'm trying to programmatically alter a package which uses a SAP .NET connector. When configuring and running the package from BIDS everything goes well. But when i try to call the AcquireConnections(vbNull) method from code , the following exception is thrown:

Unable to cast COM object of type 'System.__ComObject' to interface type 'System.Transactions.IDtcTransaction'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{0FB15084-AF41-11CE-BD2B-204C4F4F5020}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

I've used the following code:



'Load template package

Creating your SharePoint Governance Plan

One of the most common questions that I get from prospects as I'm talking to them about the creation of a governance plan and process is what does it look like. In other words, there are materials available which describe what should be in a governance plan but there isn't a ton of guidance on what the process of creating a governance plan and process are.

Creating Paging for a Repeater Control

A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.

Creating an AJAX Repeater in ASP.NET MVC

The "TaskList" is a tried an true example of the most basic thing that you can do in any framework. Unfortunately, I had some problems finding a really good example of all the steps necessary to get a task list to work in ASP.NET MVC 1.0.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend