IT Community - Software Programming, Web Development and Technical Support

Having Some Issues in DataGrid

This is a discussion on Having Some Issues in DataGrid within the ASP and ASP.NET Programming forums, part of the Web Development category; Hi, Iam having an Issues in my datagrid. Here is my data 1 Resource1 SubResource1 rating1 2 SubResource2 rating2 3 ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-17-2007, 10:37 PM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Having Some Issues in DataGrid

Hi,

Iam having an Issues in my datagrid.

Here is my data

1 Resource1 SubResource1 rating1
2 SubResource2 rating2
3 SubResource3 rating3
4 SubResource4 rating4
5 Resource2 SubResource1 rating1
6 SubResource2 rating1
7 Resource3 SubResource1 rating1


How can i put it in a datagrid ?
I don't want the Resource(2nd column) to get repeated in all the rows.

Could someone help me , How can i do this with the help of Rowspan?
__________________
-Murali..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-18-2007, 02:56 AM
Gopisoft Gopisoft is offline
D-Web Sr.Programmer
 
Join Date: Feb 2007
Posts: 117
Gopisoft is on a distinguished road
Default Re: Having Some Issues in DataGrid

Hi,

Write the SQL Query it has Group by and can check whether the Previous Classification is already repeated by Storing the Previous Id
If it is same we can use Row span property and Hide the Columns On Item data bound
Sample Code is Given Below

Code:
public void setNoDataFound(Object sender,DataGridItemEventArgs e)
{
	if(m_DataExists == false)
	{
		for (int i = 0;i < e.Item.Cells.Count;i++)
		{
			e.Item.Cells[i].Visible = false;
		}
		TableCell c = new TableCell();
		c.Text = "No Data Found";
		e.Item.Cells.Add(c);   
		dg.Width = System.Web.UI.WebControls.Unit.Percentage(100);
	}	
	else
	{
		try
			{
				if(prev_CategoryId != Convert.ToInt32(e.Item.Cells[0].Text) && prev_CustomerId!=Convert.ToInt32(e.Item.Cells[1].Text))
				{
					prev_CategoryId = Convert.ToInt32(e.Item.Cells[0].Text);
					prev_CustomerId=Convert.ToInt32(e.Item.Cells[1].Text);
					int rspan;
					rspan = ds.Tables[0].Select("CustomerCategoryID=" +  prev_CategoryId).Length ;
					e.Item.Cells[0].RowSpan = rspan;
					e.Item.Cells[1].RowSpan = rspan;
					e.Item.Cells[2].RowSpan = rspan;
				}
				else
				{
					e.Item.Cells[0].Visible = false;
				}
		}
		catch
		{
	
		}
		dg.Width = System.Web.UI.WebControls.Unit.Percentage(100);
	}
}


-R.Gopi
Attached Images
File Type: jpg datagrid.JPG (21.4 KB, 2 views)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report Issues Sundaram ASP and ASP.NET Programming 0 03-10-2008 02:53 AM
Apple Issues iPhoto Security Fix Shanthi Technology BUZZzzzzz 0 02-05-2008 09:29 PM
LDAP installation and Configurations issues kingmaker Operating Systems 5 09-12-2007 05:51 AM
Copy-Write issues simplesabita Software Testing 1 09-06-2007 12:50 AM
Common issues with Sony DVD Drive ? itbarota Computer Hardware 2 08-06-2007 08:50 AM


All times are GMT -7. The time now is 09:03 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0