How to change the Rows of the one table to another table

I want's to change the layout of my table at run time on the basis of some of my Setting File[I don't want's to use webpart orwebzones]

Suppose I have three Tables with number of rows.[In reality Each row will contain some controls]

On Page_Preinit I want's to set the rows of one table to another also want's to change order of the rows.

How Can I do that ? 

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table width="100%">
                <tr>
                    <td width="33%" valign="top">
                        <table width="100%" runat="server" id="Table1">
                            <tr>
                                <td runat="server" id="Td1">
                                    A1
                                </td>
                            </tr>
                            <tr>
                                <td runat="server" id="Td2">
                                    A2
                                </td>
                            </tr>
                            <tr>
                                <td runat="server" id="Td3">
                                    A3
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td width="34%" valign="top">
                        <table width="100%" runat="server" id="Table2">
                            <tr>
                                <td runat="server" id="Td4">
                                    B1
                                </td>
                            </tr>
                            <tr>
                                <td runat="server" id="Td5">
                                    B2
                                </td>
                            </tr>                            
                        </table>
                    </td>
                    <td width="33%" valign="top">
                        <table width="100%" runat="server" id="Table3">
                            <tr>
                                <td runat="server" id="Td7">
                                    C1
                                </td>
                            </tr>
                            <tr>
                                <td runat="server" id="Td8">
                                    C2
                                </td>
                            </tr>
                            <tr>
                                <td runat="server" id="Td9">
                                    C3
                                </td>
                            </tr>
                             <tr>
                                <td runat="server" id="Td10">
                                    C3
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>
 

 


Kamran Shahid
Sr. Software Engineer
(MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])
Netprosys Inc.
www.netprosys.com

Remember to click "Mark as Answer" on the post that helps U
0
kamii47
7/30/2007 7:03:38 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

5 Replies
1218 Views

Similar Articles

[PageSpeed] 9

There are a couple of options to give you complete control over the rendering of tables...

1. Based on your conditions you can generate the rows and the columns like as shown in the example below taken from http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.table.rows.aspx

// Generate rows and cells.          
        int numrows = 3;
        int numcells = 2;
        for (int j = 0; j < numrows; j++)
        {         
            TableRow r = new TableRow();
            for (int i = 0; i < numcells; i++) {
                TableCell c = new TableCell();
                c.Controls.Add(new LiteralControl("row "
                    + j.ToString() + ", cell " + i.ToString()));
                r.Cells.Add(c);
            }
            Table1.Rows.Add(r);
        }

2. You could use a string literal in your c# class to actually build your tables like "<table><tr><td><td><tr>..."

0
suprej
7/30/2007 8:08:51 PM

That is not what i want's.I know how to generate the Tables and rows.

I have some predeifned tables with some rows.

I want's to change one row from one table to another row from another table 


Kamran Shahid
Sr. Software Engineer
(MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])
Netprosys Inc.
www.netprosys.com

Remember to click "Mark as Answer" on the post that helps U
0
kamii47
7/31/2007 5:06:19 AM

If you have predefined tables and you know what is inside the tables before, then you can just add all the rows that you need into the table, hide the ones that you want and display the others...since all your rows are accessible in your code you could just go Table2Td1.Visible=false....

 <td width="33%" valign="top">
                        <table width="100%" runat="server" id="Table1">
                            <tr>
                                <td runat="server" id="Td1">
                                    A1
                                </td>
                            </tr>
                            <tr>
                                <td runat="server" id="Td2">
                                    A2
                                </td>
                            </tr>
                            <tr>
                                <td runat="server" id="Td3">
                                    A3
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td width="34%" valign="top">
                        <table width="100%" runat="server" id="Table2">
                            <tr>
                                <td runat="server" id="Td4">
                                    B1
                                </td>
                            </tr>
                            <tr>
                                <td runat="server" id="Td5">
                                    B2
                                </td>
                            </tr>          

                           <td runat="server" id="Table2Td1" visible="false"> //so now you have a row from Table 1 hidden, you can hide it or display it
                                    A1
                                </td>
                            </tr>
                            <tr>
                                <td runat="server" id="Table2Td2" visible="false">
                                    A2
                                </td>
                            </tr>
                 
                        </table>
                    </td>

0
suprej
7/31/2007 7:50:35 AM

Read up on the DOM methods for removeChild, removeNode, and appendChild.  These are what you would use to remove a row from one table and add it to another table, respectively.  Internet Explorer has a table API (with methods like insertRow and deleteRow) that you can read about at http://msdn2.microsoft.com/en-us/library/ms535901.aspx, but these attributes don't necessarily translate to other browsers like Firefox and Safari.

Regards,


Peter Brunone
MS MVP, ASP.NET
Founder, EasyListBox.com
Do the impossible, and go home early.
0
PeterBrunone
7/31/2007 8:13:17 AM

 Then what Can I do to achieve these Functionality.

I basically have a data entry form with number of section.

A user with site administrator role can set the order of the entry.

I will save it in an xml file then on the DataEntry pages  render my control to certain section on the basis of it.

Any Idea How Can I achieve that ? 


Kamran Shahid
Sr. Software Engineer
(MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])
Netprosys Inc.
www.netprosys.com

Remember to click "Mark as Answer" on the post that helps U
0
kamii47
7/31/2007 10:10:39 AM
Reply:

Similar Artilces:

Deleting rows from one table based upon rows in another table
I need to delete rows from table1 based on rows in table2. table1 has 1.5 million rows from which I need to delete 20,000 existing in table2. The table structures are the same and I must exactly match 10 (of the 15) columns in the tables. I also need to limit the number of rows being worked on, in a single transaction, to 500 or so. Hi Mike, try the following: set rowcount 500 DELETE table1 from table1 t1,table2 t2 where t1.col1=t2.col1 and t1.col2=t2.col2 and t1.col3=t2.col3 and ........ t1.col10=t2.col10 HTH. Regards P:S You must re-execute the DML statement above 40 time...

Copying html table rows from one table to another.
Hi Im am trying to copy table rows from one html table to another. Below is a one of my many attempts and all this does is moving the rows from the one table to the other. I would appreciate any help. int iCount; HtmlTableRow[] TableRows = new HtmlTableRow[Table1.Rows.Count]; Table1.Rows.CopyTo(trs,0); for (iCount = 0; iCount < TableRows.Length; iCount++) { Table2.Rows.Add(TableRows[iCount]); } Thanks ...

can I compare one record from one table to another record in another table?
can I compare one record from one table to another record in another table? I need to test if this condition is met. My scenario is: i need to check one table for a value and compare it to a list of records. for example, table 1           columnrecord 1- applesrecord 2- orangesrecord 3- grapes table 2            col1   col2   col3    col4record 1- Null , Null, Null, grapes I need to compare table 2 records with a list of records from table 1. the fru...

Update a rows in one table for each row in other table
Hello all, i am a newbie in SQL and i want to ask for your help in order to do the following update statement. I have a table tblUsers which holds all the users, one of the fields in their GroupId. In the UserGroup table i have a field "UsersCount" and in that field i want to keep the number of the users in that group. Basically i want everytime i am saving a user to recalculate the users in all usergroups. I am trying to have something like:SELECT User_GroupId, count(User_GroupId) as UsersCount FROM tblUsersWHERE DeletedFlag = 0 GROUP BY User_GroupId and then:"FOR EACH" User_GroupIdUPDAT...

Need to transfer certain rows from one table into another table
On my online store, I need to figure out with sql how I can copy data from several different tables into another table: There is a table that contains all of the customers billing infoanother table has customer's shipping info The target table is for tracking and processing orders.  I will need to populate different fields from different tables, as well as insert values into fields from my code behind (i.e. customers can choose different types of shipping, payment options).  I googled this and keep running into the join statement (which I use all the time).  I don't ...

Getting information from one table and applying it to another table record.G
Hello, I'm creating a website in ASP.NET and C#, My problem is I want to add a new record to a table using data from another table. i.e. Add a book, to set the book category you have to select if from a databound dropdown in another table. All those categories are stored in a different table. I'm not sure how to do that. Any help is appreciated. Thanks a lot!! Gabriel do datasource copy in the server-side or javascript copy in the client-sideRichard Tsuei (Chikun Cui)Contact me via E-mail: ricktsuei@gmail.comWeblog: http://ricktsuei.cnblogs.com+-+-+-+-+-+-+-+-+-+-+-+-+-...

Record from one table, calcs on each row of another table
Imagine two tables. Table 1 has various tombstone information, including Latitude and Longitude. Table 2 has a bunch of locations, each with a latitude and longitude. I've created a class for various geomaths; in this case, distance between two GPS coords, and bearing from point A to point B.  Set startlat, startlong, endlat, endlong, and read distance and bearing properties, the class does the maths.  So, what I want to do is read a record from Table 1; this record is displayed, at the moment, in a DetailsView. I want to read each record from table 2, calculate the distan...

CheckBoxList gets text from one table, send values to another table
I am working on making a CheckBoxList in a DetailsView that allows the user to check the boxes of the services they would like to receive. In my SQLDataSource, I have two tables that are involved in this. Columns "ServiceID" and "Name"are stored in one table, "Services," and the columns "UserID" and "ServiceID" are stored in another table, "UserServices." I want the CheckBoxList to grab the value and the name of all the services available and have a box for each with the name beside each box. Once the user clicks on each box they want and then click "Submit" I want all rows in table "Use...

selecting one row and inserting it into another table one by one
i ve a table named "Employee" in wh i ve fields "Emp_Id","Name" and "Email". i want to select each employee "Emp_Id" one by one from "Employee" table and insert it into another table named "Concerned_Department". like if i ve three rows in "Employee" table with "Emp_Id" 1,2 and 3 respectively,in this case i want to first select "Emp_Id"=1 then "Emp_id"=2 and lastly "Emp_id"=3 and insert them into "Concerned_Department"table.  after that the process star...

is there an sql statement to insert data to one table and getting the data from another table
Ok I have a table that have general categories with just name and CatNo. Now what I want to know is when I create a client to move all the data in general categories to another table called categories that have the clientid to associate it with the client. I would appreciate for any help what is your question here??Shravan Addaypally MCP...

How to get one database table data in to an input form to put info in another table.
The table data to pull from is place on the same page as the input form, it is also the same number used as the URL Parameter, so if I coiuld pull it from there it would be easier, what code do I need to do this in my input form? You will need two simple scripts set up. The first will bind the data to your form controls when the page loads. The second will insert the data from the form into the database. The syntax will vary a little depending on your database type and the language you want to use to create the code. Check out this tutorial for how to do all it is you need to know re...

more efficient way to get Array of rows from one table to another
Is there a more efficent way to get an array of rows returned from a DataTable.Search into another table. Ok I have a Dataset and one of the tables in it contains around 2000 rows. Now when I am working with a specific piece I am Cloning that table and copying the relevant data into that cloned table. The reason I do this is because it is much much easier to work with in that one spot with only the one datatable. However thier is no Copy method or anything on a row. and if you try to Add that row directly it throws an exception saying that the row already belongs to another table. and...

1 record from one table N records from another table using gridview in single row?
Hi there, I have 2 tables named question(questionid,question) and options(optionid,options) In that questions table I got one record and in options table 3 records. Whenever I query I got 3 records 1)question1 choice1 2)question1 choice2 3)question1 choice3 I would like to use gridview(I would like to edit those values) to display these in a single row. like Question1 ch1 ch2 ch3(one record) . But the problem is I always getting 3 rows. I have seen some example(nested datalist) but they are using only one table, I am using 2 tables. Can any one help me to acheive th...

Select rows from a table based on multiple rows of another table
I am working in a database associated with our scheduling package and I am trying to select rows in one table based on multiple rows in another table how ca I do this. Here is an example. ...

Web resources about - How to change the Rows of the one table to another table - asp.net.getting-started

Chris Hemsworth & Kat Graham Hit Up SNL After Party
Chris Hemsworth is mobbed by fans as he heads to the Saturday Night Live after party on Saturday (December 12) in New York City. The 32-year-old ...

NBC Poll: Clinton Would Trounce Trump But Lose to Rubio, Carson
NBCNews.com NBC Poll: Clinton Would Trounce Trump But Lose to Rubio, Carson NBCNews.com Hillary Clinton would defeat Ted Cruz and trounce ...

China, US leaders hold telephone call on Paris climate accord-Xinhua
Xinhua China, US leaders hold telephone call on Paris climate accord-Xinhua Daily Mail BEIJING, Dec 14 (Reuters) - China's President Xi Jinping ...

Russia fires on Turkish ship to 'avoid collision' in Aegean Sea
CNN Russia fires on Turkish ship to 'avoid collision' in Aegean Sea CNN (CNN) A Russian warship has fired warning shots at a Turkish boat ...

Taylor Swift and her doppelgänger finally met when she toured Australia
Being mistaken for Taylor Swift is something Olivia Sturgiss knows all too well. Hailing from New South Wales, Australia, Sturgiss is a 19-year-old ...

Deputies In Lynwood Fired 33 Bullets At Suspect Captain Says Was Armed With ...
CBS Local Deputies In Lynwood Fired 33 Bullets At Suspect Captain Says Was Armed With ... CBS Local LYNWOOD (CBSLA.com) — Sheriff's deputies ...

Jose Aldo translator criticised for UFC 194 post-fight mistakes - McGregor vs Aldo video
THE translator has come under fire after his sloppy job in the post-fight interview made beaten champion Jose Aldo look like a sore loser.

French far-right National Front, Le Pen, come up mostly empty in regional ...
Hindustan Times French far-right National Front, Le Pen, come up mostly empty in regional ... The Week Magazine The big winner in French regional ...

Independence Day: Resurgence trailer sows seeds of hopelessness
The first trailer for Independence Day 2, a.k.a. Independence Day: Resurgence, which unexpectedly landed in the middle of a Sunday afternoon ...

Saudi Arabia Needs EMILY's List... And France Needs To Remember How Bad Fascism Is
France was an absolute monarchy in 1302 when the aristocracy (including ecclesiastics) forced a semi-parliament, the Estates-General, on the ...

Resources last updated: 12/14/2015 8:28:22 AM