How to display table data in row by row [Resolved]

Posted by Venky.Net under ASP.NET on 11/29/2013 | Points: 10 | Views : 4235 | Status : [Member] | Replies : 6
hi
i am trying display table value row by row in grid view.i want output this format



example:
i am got output this format, i want output first display description and column 1 value and next display another discription and value



0 1 2
Description COST OF CASTING COST OF ALUMINUM
CostOfaluminumpatternwithcorebox 6 2 2
Costofcasting000kgsCastIron 3 3
Costofmachiningandpainting 4 4
Overheadspackingforwardingand
transportation 5 5
Costofthecomponent 3 6
Totalcostofthecomponentfor000Nos 12 17

i want o/p this format

Description COST OF CASTING
CostOfaluminumpatternwithcorebox 6
Costofcasting000kgsCastIron 3
Costofmachiningandpainting 4
Overheadspackingforwardingand
transportation 5
Costofthecomponent 3
Totalcostofthecomponentfor000Nos 19

Description COST OF CASTING
CostOfaluminumpatternwithcorebox 6
Costofcasting000kgsCastIron 3
Costofmachiningandpainting 4
Overheadspackingforwardingand
transportation 5
Costofthecomponent 3
Totalcostofthecomponentfor000Nos 19


Description COST OF Aluminum
CostOfaluminumpatternwithcorebox 2
Costofcasting000kgsCastIron 2
Costofmachiningandpainting 2
Overheadspackingforwardingand
transportation 2
Costofthecomponent 2
Totalcostofthecomponentfor000Nos 10

please help me


public DataSet c()
{
DataSet ds = new DataSet();



string san = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;

DataTable table = new DataTable();

using (SqlConnection conn = new SqlConnection(san))
{

string sql = "Select Chemicals,Min,Max from dbo.tbl_ChemicalMaster where Chemicalstd='" + dropchemical.SelectedItem.Text + "'";

using (SqlCommand cmd = new SqlCommand(sql, conn))
{

using (SqlDataAdapter ad = new SqlDataAdapter(cmd))
{

ad.Fill(table);
}
}
}

ds.Tables.Add(table);
return ds;



}
public DataSet FlipDataSet(DataSet my_DataSet)
{
DataSet ds = new DataSet();
foreach (DataTable dt in my_DataSet.Tables)
{
DataTable table = new DataTable();
for (int i = 0; i <= dt.Rows.Count; i++)
{
table.Columns.Add(Convert.ToString(i));
}
DataRow r = null;
for (int k = 0; k < dt.Columns.Count; k++)
{
r = table.NewRow();
r[0] = dt.Columns[k].ToString();
for (int j =1; j <= dt.Rows.Count; j++)
r[j] = dt.Rows[j - 1][k];
table.Rows.Add(r);
}
ds.Tables.Add(table);
}


return ds;
}




Responses

Posted by: vishalneeraj-24503 on: 11/29/2013 [Member] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
Hi you have to design your gridview accordingly like inside ItemTemplate you can take <Table>
and design accordingly. Or alternatively you can replace Gridview with datalist control.

Venky.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 11/29/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Please refer below links:-
http://www.youtube.com/watch?v=CSwS91DT4cA

Venky.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Venky.Net on: 11/29/2013 [Member] Starter | Points: 25

Up
0
Down
i can't understand your answer please explain detail my mail id venkyram96@gmail.com

Venky.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 11/29/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
So,you got the solution you want.

Venky.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Venky.Net on: 11/29/2013 [Member] Starter | Points: 25

Up
0
Down
no I am Getting Answer.please give some idea

Venky.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Venky.Net on: 11/29/2013 [Member] Starter | Points: 25

Up
0
Down
i am not getting answer.please give some idea

Venky.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response