studio NETSOULS

Applying Web To Your Business

This code is useful to transpose the datatable rows and columns.

   1: DataTable dtSource = new DataTable();
   2: protected void Page_Load(object sender, EventArgs e)
   3:    {
   4:     // Bind the source datatable from the database
   5:     dtSource = dataSource();
   6:    }
   7:  
   8: public DataTable FlipDataTable(GridView gvNew)
   9:     {
  10:         DataTable dataTable = new DataTable("dataTable");
  11:  
  12:         // create column
  13:         DataRow newRow;
  14:         for (int iRow = 0; iRow < dtSource.Columns.Count; iRow++)
  15:         {
  16:             newRow = dataTable.NewRow();
  17:  
  18:             newRow[0] = dtSource.Columns[iRow].ToString();
  19:  
  20:             for (int iCol = 1; iCol <= dtSource.Rows.Count; iCol++)
  21:             {
  22:                 newRow[iCol] = dtSource.Rows[iCol - 1][iRow];
  23:             }
  24:  
  25:             dataTable.Rows.Add(newRow);
  26:         }
  27:     }
  • Currently 0 /5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

The software development methodology does not change, whether the development is done domestically in the United States, Europe or any other part of the world.

Our team works with an industry standard software development methodology. You will be in direct communication with the project manager who will track your project through all the phases of development, from needs analysis, requirements documentation, prototyping, development, testing, release, business practice integration and support.

The work will be done in our offshore office, but through the power of the Internet and through our very strong communication skills, it will feel as though we were working right in your facility.More...

  • Currently 0 /5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Lets suppose you have a data source in XML like:

   1: <Settings> 
   2:    <ElementCollection> 
   3:          <add key="SomeKey" value="SomeValue"> 
   4:          <add key="SomeKey" value="SomeValue"> 
   5:    </ElementCollection> 
   6: </Settings>


Now you want to edit the key and values with in the xml element collection.

<asp:XmlDataSource ID="configXmlDataSource" XPath="//add" runat="server" DataFile="~/settings.config"/>

Use the following code in the code-behind

   1: // In this code we are getting the Data Item values of the Rad Editor. On UpdateCommand Event we are getting the values of data row in an instance of hash.
   2: GridDataItem dataItem = (GridDataItem)e.Item; 
   3: Hashtable ht = new Hashtable(); 
   4: dataItem.ExtractValues(ht);
   5:  
   6: //Get the node values as per the selected key name: 
   7: XmlNode AppNode = XmlDataSource1.GetXmlDocument().SelectSingleNode( String.Format("//add[@key='{0}']", key)); 
   8:  
   9: //Now assign the new value of the Value attribute of the selected node:
  10: AppNode.Attributes["value"].Value = ht["value"];
  11:  
  12: //Finally we need to update the xml source file:
  13: configXmlDataSource.Save();
  • Currently 0 /5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Let's create and populate some tables so we have some data to work with. Assume you have a sales effort management (SEM) system that allows you to track the number of sales calls made on a potential client. A sales call is not a phone call, but a get together such as lunch or another type of person-to-person meeting. One of the things the VP of Sales wants to know is how many of his sales personnel participate in a call. The following tables allow you to track this information.

   1: CREATE TABLE Employees
   2: (
   3:     Emp_UniqueID smallint PRIMARY KEY,
   4:     Emp_FName varchar(30) NOT NULL,
   5:     Emp_LName varchar(30) NOT NULL,
   6: )
   7: go
   8:  
   9: CREATE TABLE SalesCalls
  10: (
  11:     SalCal_UniqueID smallint PRIMARY KEY,
  12:     SalCal_Desc varchar(100) NOT NULL,
  13:     SalCal_Date smalldatetime NOT NULL,
  14: )
  15: go
  16:  
  17: CREATE TABLE SalesCallsEmployees
  18: (
  19:     SalCal_UniqueID smallint NOT NULL,
  20:     Emp_UniqueID smallint NOT NULL,
  21: )
  22: go

More...

  • Currently 0 /5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

About Us

studio NETSOULS is a complete IT services company, offering strategy, design, development and implementation of the total solution for your web and IT initiatives. The solutions we provide, enables businesses to leverage leading edge technology to gain sustainable competitive advantages in today's marketplace.

We specialize in designing, developing and deploying the next generation of IT solutions including e-business solutions Read more...

Tags

This will be shown to users with no Flash or Javascript.

Contact Us

My status

Quote of the Day

Men are disturbed, not by the things that happen, but by their opinion of the things that happen

- Epictetus

NutritionVista

www.NutritionVista.com

Archives


Advertisements


Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Log in