CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > microsoft_downloads.css_friendly_control_adapters Tags:
Item Type: NewsGroup Date Entered: 12/14/2006 12:18:54 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 97 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
xetick
Asp.Net User
Empty template support for GridView12/14/2006 12:18:54 PM

0/0

Just add the following to support the empty text in the GridView.

 

protected override void RenderContents(HtmlTextWriter writer)
{
	if (Extender.AdapterEnabled)
	{
		GridView gridView = Control as GridView;
		if (gridView != null)
		{
			if ((gridView.Rows.Count == 0) && !String.IsNullOrEmpty(gridView.EmptyDataText))
			{
				writer.WriteLine();
				writer.WriteBeginTag("div");
				writer.WriteAttribute("class", "AspNet-GridView-Empty");
				writer.Write(HtmlTextWriter.TagRightChar);
				writer.WriteLine();
				writer.WriteLine(gridView.EmptyDataText);
				writer.WriteEndTag("div");
				return;
			}

Example of tag to be added to the css
 
.NiceGridView .AspNet-GridView div.AspNet-GridView-Empty
{
	border-width: 1px;
	border-style: solid;
	border-color: #aaaaaa;
	padding: 2px;
}
 Cheers
 Joakim E. 
 
 
Joakim E - Working at Play'n GO & Playing around at Plane9
kjarrodc
Asp.Net User
Re: Empty template support for GridView1/1/2007 10:13:49 PM

0/0

Thank you for posting this solution.  I found it helpful and have used it.  The only thing I would add is that you can?t necessarily use the ?EmptyDataTemplate.?  You have to configure the ?EmptyDataText? property for the gridview.  Obvious ? I know, but I hope pointing it out saves others some time if needed.

 

Also, here?s the VB version:

 

                                    If (gridView.Rows.Count = 0) And Not String.IsNullOrEmpty(gridView.EmptyDataText) Then

                                                writer.WriteLine()

                                                writer.WriteBeginTag("div")

                                                writer.WriteAttribute("class", "AspNet-GridView-Empty")

                                                writer.Write(HtmlTextWriter.TagRightChar)

                                                writer.WriteLine()

                                                writer.WriteLine(gridView.EmptyDataText)

                                                writer.WriteEndTag("div")

                                                Return

                                    End If

Christopher_G_L
Asp.Net User
Re: Empty template support for GridView1/4/2007 5:53:55 PM

0/0

I think I've got a fix for the EmptyDataTemplate issue:

 Add the following to RenderContents in GridViewAdapter.cs right before the ///// BODY //// section

  

/////////////// EmptyDataTemplate ///////////////////////
if (gridView.Rows.Count == 0) {
	//Control[0].Control[0] s/b the EmptyDataTemplate.
	if (gridView.HasControls()) {
		if (gridView.Controls[0].HasControls()) {
			if (gridView.Controls[0].Controls[0] is GridViewRow) {
				rows.Clear();
				rows.Add(gridView.Controls[0].Controls[0]);
				gvrc = new GridViewRowCollection(rows);
				WriteRows(writer, gridView, gvrc, "tfoot");
			}
		}
	}
}					

 

Add the following to GetRowClass right before return className.Trim();

//// EmptyDataTemplate
if ((row.RowType & DataControlRowType.EmptyDataRow) == DataControlRowType.EmptyDataRow) {
className += " AspNet-GridView-Empty ";
}

 

Finally, if you want to override the standard tfoot style, add a CSS section in GridViewExample -   

.AspNet-GridView table tfoot tr.AspNet-GridView-Empty td
{
    color: #F7F6F3;
    background: #5D7B9D;
    font-weight: bold;
    border-bottom: solid 1px #CCCCCC;
    border-right: solid 1px #CCCCCC;
    padding: 2px;
}

Hope this helps

-Chris


http://www.christopherlewis.com
Stelly
Asp.Net User
Re: Empty template support for GridView4/24/2007 10:35:55 AM

0/0

why am I getting the following:

Error 6 'CompSoft.RenderContents(System.Web.UI.HtmlTextWriter)': no suitable method found to override I:\WebApps\ComputerLogging\CompSoft.aspx.cs 25 29 I:\WebApps\ComputerLogging\

Stelly

4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Beginning ASP.NET 2.0 Databases: Beta Preview Authors: John Kauffman, Thiru Thangarathinam, Pages: 427, Published: 2005
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007
Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1148, Published: 2006
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Beginning ASP.NET 2.0 with C# Authors: Chris Hart, John Kauffman, David Sussman, Chris Ullman, Pages: 735, Published: 2006
ASP.NET 2.0 MVP Hacks and Tips Authors: David Yack, Joe Mayo, Scott Hanselman, Fredrik Normén, Dan Wahlin, J. Ambrose Little, Jonathan Goodyear, Pages: 400, Published: 2006
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008

Web:
Empty template support for GridView - ASP.NET Forums Empty template support for GridView. Last post 04-24-2007 6:35 AM by Stelly. 3 replies. Sort Posts:. Oldest to newest, Newest to oldest ...
Find the detailsview contained in Gridview Empty Data Template ... Find the detailsview contained in Gridview Empty Data Template ... Microsoft Online Community Support Please remember to click “Mark as Answer” on the post ...
GridView.EmptyDataTemplate Property (System.Web.UI.WebControls) To specify a custom template for the empty data row, first place < EmptyDataTemplate> tags between the opening and closing tags of the GridView control. ...
EMPTY DATA TEMPLATE ON GRIDVIEW NOT DISPLAYING ASP.NET C# Just cannot get empty data template to show when no records are returned in gridivew. ... Automotive; Business Travel; Community Support; Expert Lounge ...
Maarten Balliauw {blog} - Code based ASP.NET MVC GridView It can do the same as the 'one-liner' function but it has proper template support, it has better maintainability (very important in larger projects where ...
CodeProject: Simple GridView Radio Button Row Selector. Free ... A custom web control to add radio button selection to the GridView control.; ... If you click the drop down you should have an Empty Data Template, ...
GridView RowCommand Not Firing As for the Footer, Header template for empty datasource case, I'm afraid so far the GridView can not display any GridViewRow when there is ...
Mr.Bool - Invoking methods from template columns in the GridView For the exposed cases and for others special cases, the GridView does not provide built-in support, we can rely on the use of the template columns which ...
ASP.NET 2.0 : Adding Sorting and Paging in GridView GridView does not support inserting data against a data source object. ... Assigining data binding to a control within a template is easy. ...
Need to get value of gridview template columns for client side ... All Levels Menu: CSS/HTML list based menu with support for infinite levels of sub menus. ... but it returns an empty string on the template columns. ...




Search This Site:










creating ssl (https) web application

current skin folder base path

frontpage extensions and ftp

domain mapping for new parent portal

how to: make "export to excel" always open excel in a separate window

how to retrieve current aspx file name ?

dnn 3.0.13 after install error an unhandled error has occurred

problem in using horizontal style

3.0.10 issue: announcements module

css frindly adapters - how to apply skin?

need help with the web.config

multiple portals, separate databases, same users, one log in ?? possible?

netscape compatible menu

site maps

enabling search on non-core modules ?

masked domain problem (dnn 2.1.2)

start up for .net security

suggestion to avoid modification to the core

displaying a simple user control in a module.

no data coming back

can i carry vbscript in included .asp files forward into .aspx pages?

allowing user to personalize css

good expanding side menu

create new user

multipage/tabstrip dynamic usercontrol dilemma

custom module, no print output?

how to utilize google gmail server in your.net windows applications

user authentication method of asp.net. is my choice right?

newblog, child blog content to appear on separate page

could we use vs 2005 image library in our apps ?

 
All Times Are GMT