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: 2/18/2008 12:58:35 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 73 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
mark4asp
Asp.Net User
How can I modify the html output from the GridView?2/18/2008 12:58:35 PM

0/0

How can I modify the html output from the GridView?

Or, alternatively, we could make it a CSS/HTML question "How can I prevent whitespace between <a> tags being rendered?"


I've noticed that the asp.net CSS-Friendly GridView (e.g. with an id="gvAwarded") is rendering html for the pager like this:

    <div class="AspNet-GridView-Pagination AspNet-GridView-Bottom">
        <span>1</span>
        <a href="javascript:__doPostBack('gvAwarded','Page$2')">2</a>
        <a href="javascript:__doPostBack('gvAwarded','Page$3')">3</a>
        <a href="javascript:__doPostBack('gvAwarded','Page$11')">...</a>
        <a href="javascript:__doPostBack('gvAwarded','Page$Last')">&gt;&gt;</a>
    </div>

I would prefer to create the following html:

    <div id="gvAwardedPager" class="AspNet-GridView-Pagination AspNet-GridView-Bottom">
        <span>1</span><a href="javascript:__doPostBack('gvAwarded','Page$2')">2</a><a href="javascript:__doPostBack('gvAwarded','Page$3')">3</a><a href="javascript:__doPostBack('gvAwarded','Page$11')">...</a><a href="javascript:__doPostBack('gvAwarded','Page$Last')">&gt;&gt;</a>
    </div>
   

The problem is that browsers (FireFox and IE6) render the white space between the <a> tags.

Also notice that I would prefer to give the pager div an id so that I can move it elsewhere on the page. I really want to display the pager to the LHS of the GridView rows.

Is it fairly easy to modify the html and are there a blogs or tutorial that can point me in the right direction?, if so can someone point me in that direction?


Here are my styles (these class names are automatically rendered by the aforementioned asp.net GridView.). I am not assigning a specific style to the GridView as all my GridViews will have the same pager style.  [if you put the style below in a html page with the two snippets above you can see for yourself what the problem is with the html from the CSS-Friendly GridView - given that this is such as well known problem I'm surprised they chose to write it like that ]

.AspNet-GridView-Bottom {margin:0;}
.AspNet-GridView-Pagination
{
    font-family: Arial, Helvetica, sans-serif;
    text-decoration: none;
    font-size: 0.65em;
    line-height: 19px;
}

.AspNet-GridView-Pagination a
{
    color: #555;
    padding: 4px 6px 2px;
    border-right: 1px solid #c5c5c5;
}

.AspNet-GridView-Pagination span
{
    background-color: #CCC;
    color: #000;
    font-weight:bold;
    border-top: 1px solid #CCC;
    padding: 4px 6px 2px;
    border-right: 1px solid #c5c5c5;
}

.AspNet-GridView-Pagination a:hover
{
    color: #333;
    background-color: #efefef;
    border-top: 1px solid #c5c5c5;
}

 

MikeJ83
Asp.Net User
Re: How can I modify the html output from the GridView?2/18/2008 6:00:57 PM

0/0

The default browser behavior is to ignore white space. Your white space problem is almost certainly being caused by CSS. Have you tried removing the padding from your .AspNet-GridView-Pagination a style? I would download the Web Developer Toolbar and use that to find what's creating the white space between your links.

Regarding the ID, do you have multiple gridviews on your page? If not, you can use div.AspNet-GridView-Pagination to reference the div in your CSS.

HTH,

-Mike

mark4asp
Asp.Net User
Re: How can I modify the html output from the GridView?2/19/2008 10:53:53 AM

0/0

The default browser behaviour is to render white space when it is between <a> tags - as it is here. My whitespace problem is not caused by CSS; although there is probably some really ugly CSS hack out there which will 'fix' it.

The space being displayed is caused by a design decision taken by the authors of the HTML spec. When there is a sequence of <a> elements the white space between them should render so that each hyperlink can be distinctly seen. The only way to stop this is to put no white space between the tags.  That is why one frequently sees code like this:

 <a href="1.html">1</a><a href="2.html">2</a><a href="3.html">3</a>

 or like this:

    <a href="1.html">1</a><a
            href="2.html">2</a><a
            href="3.html">3</a>

 which we tend to get when the html coder is using CSS to render the list of links as a list of boxes.

 

MikeJ83
Asp.Net User
Re: How can I modify the html output from the GridView?2/19/2008 7:21:10 PM

0/0

Well I'll be damned. Here's what you can do, assuming you are using the 9278 version of the code, make the following changes to your GridViewAdapter.cs:

Comment out the writer.WriteLine(); on line 401
Insert the following statement on line 393, after the class attribute: writer.WriteAttribute("id", Extender.AdaptedControl.ClientID + "Pager");

Recompile and your done.

mark4asp
Asp.Net User
Re: How can I modify the html output from the GridView?2/26/2008 2:56:35 PM

0/0

I seem to be using the wrong version of the code but I downloaded it quite recently from here (I think) or from codeplex. The source I have consists of a website with a GridViewAdapter.cs in the App_Code/Adapters folder.  As for the version number - I don't know.  The dll has a 1.0.0.0 version number.  Anyhow, right at the bottom of the code, inside WritePagerSection() there is:

                    TableRow row = innerTable.Rows[0];
                    foreach (TableCell cell in row.Cells)
                    {
                        foreach (Control ctrl in cell.Controls)
                        {
                            writer.WriteLine();
                            ctrl.RenderControl(writer);
                        }
                    }


I can see that what the corresponding line to remove is but I can't quite see where I should insert that line to associate an ID with the div.  I put it here anyway:

                    writer.WriteBeginTag("div");
                    writer.WriteAttribute("class", className);
                    writer.Write(HtmlTextWriter.TagRightChar);

goes to:
                    writer.WriteBeginTag("div");
                    writer.WriteAttribute("id", Extender.AdaptedControl.ClientID + "Pager");
                    writer.WriteAttribute("class", className);
                    writer.Write(HtmlTextWriter.TagRightChar);

No matter, I can't figure out how to turn my source code, written as a web site, into one which just produces a single dll, because when I build it, the dll is only 80k and my current dll is 96k. I think I must have an earlier version of the source.  Thanks for your help. I am nearly there.

 

 

 

mark4asp
Asp.Net User
Re: How can I modify the html output from the GridView?2/26/2008 3:07:35 PM

0/0

I got the most recent source form codeplex and have now fixed the problem.  Thanks again.

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


Free Download:

Books:
Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages Authors: Jacob J. Sanford, Pages: 474, Published: 2007
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 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008
ASP.NET 2.0: A Developer's Notebook Authors: Wei Meng Lee, Pages: 326, Published: 2005
Beginning ASP.NET 2.0 Databases: From Novice to Professional Authors: Damien Foggon, Pages: 625, Published: 2006
Beginning ASP.NET 2.0 in VB 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1063, Published: 2006
ASP.NET 2.0 Black Book: black book Authors: Dreamtech Software, Dreamtech Software, Charul Shukla, Anil Kumar Barnwal, Dreamtech Software India, Pages: 1167, Published: 2006
Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1148, Published: 2006

Web:
How can I modify the html output from the GridView? - ASP.NET Forums How can I modify the html output from the GridView? Or, alternatively, we could make it a CSS/HTML question "How can I prevent whitespace ...
Matt Berseth: Export GridView to Excel Well the limitation is within Excel itself (pre 2007) and is not a problem related to gridview and the export... Also the export generates plain html so ...
Gridview 8-03 Added ability to modify planet dimensions for measurement accuracy ... 5-4- 01 : Added a scale bar to the postscript output plots ...
CodeProject: ASP.NET GridView Extension [Client Side Sortable ... Feb 26, 2008 ... I have parsed and made the final output of this custom control highly structured than the MS grid, and it includes an HTML table wrapped by ...
How to render a page’s HTML? « Imran Akram’s Blog Jul 8, 2008 ... I’ve tested the code and now I’m trying to modify it to get the HTML of a gridview. Wish me luck! <%@ Page Language=”VB” %> ...
ArcGIS Server Development Blog : Extending the QueryAttributesTask ... Feb 12, 2007 ... the DataTable and getting the HTML output from the GridView. ... It is not possible to easily modify them to instead output tags and ...
RE: GridView reload for the updated records. we can not directly modify them at clientside or at serverside (without ... I have a search which shows output in a gridview. I have one Select ...
GridView DataFormatString for handling strings? asp.net (C# code ... Text = output;; }; }; public string CapitalizeWord(Match match); {; StringBuilder sb = new ... When you reference the Cell number that you want to modify. ...
GridView Grouping Master/Detail Drill Down using AJAX and jQuery Not really sure I see the logic in returning html in json, defeats the point of a ... Thank you Dave, I just used your method to modify my sample. ...
difference between datagrid and gridview u can modify the values both in datagrid and in grid view. ... the GridView control was designed to display data in an HTML table. ...




Search This Site:










trying to understand

error loading module

still cannot compile 3.1.1

programatically progress through tree nodes

using system.web / membership outside of a web project

aspnet db security concerns

manage member (asp.net 2.0)

discussion module error(s)

default page.aspx login vs login from login page.aspx

where is mobile support in dnn2.0

creating a module using notepad for dnn3

losing file permissions

dnn, portalwebhosting, and you

where can i found modules?

a few forms authentication questions

problem with webpart in visual studio 2005.. help me out.

smart google adsense module?

wizard buttons & javascript

type "profilecommon" is not defined

trouble adding c# code

genericdatabase not passing parameter to stored proc

caption in albums

assist a stupid newbie coder on error message

solution help - different types of installations?

any plans to enhance document control?

glitch in user account module dnn 3.1.1??

response.writefile and access denied

roles.getusersinrole

debugging file io in c++

upgrade steps for dnn 2.0.4 to 2.1.2?

 
All Times Are GMT