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/21/2007 7:06:15 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 8 Views: 106 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
9 Items, 1 Pages 1 |< << Go >> >|
S Boyer
Asp.Net User
GridView Adapter with PagerTemplate broken2/21/2007 7:06:15 AM

0/0

In using the CSS Control Adapters on a paged GridView, initially all worked correctly.  However, as soon as I added a PagerTemplate to the GridView markup, paging disappeared, never to return.  I tracked this down to the WritePagerSection() method in GridViewAdapter, which apparently only has logic to process the <table> tags that the ASP.NET GridView normally uses for the built-in paging markup. I confirmed this by building a PagerTemplate like this:

<PagerTemplate><asp:Table ID="tmp" runat="server"><asp:TableRow runat="server"><asp:TableCell runat="server">
    <asp:LinkButton Tooltip="Previous Page" CommandName="Page" CommandArgument="Prev" runat="server" ID="btnPrevious" OnCommand="Paginate" >Previous</asp:LinkButton>
</asp:TableCell></asp:TableRow></asp:Table></PagerTemplate>

which correctly outputs the paging section (no spaces or returns may be between PagerTemplate and the table tags or the WritePagerSection() logic sees the them as a Literal and ignores the PagerTemplate, or more precisely the contents of the Top/BottomPagerRow).

I'm not very familiar with the Template/ControlBuilder area of ASP.NET, but I think that by the time WritePagerSection() is called, Top/BottomPagerRow contains the parsed control array from PagerTemplate.  I implemented else logic in WritePagerSection() to simply iterate over the Controls collection from Top/BottomPagerRow and call RenderControl (wrapping it all with a <div> as the existing logic does).

Is this a known issue? Is my simple solution of iterating over the controls array with RenderControl sufficient in all cases?

Thanks, Shane 

t0ny
Asp.Net User
Re: GridView Adapter with PagerTemplate broken3/6/2007 2:07:07 PM

0/0

I think I am slightly lost here, but certainly the CSS Control Adapters don't render my PagerTemplate within my GridView.

I have had to comment out the gridview adaptor, which is a big shameSad:

  <!--<adapter controlType="System.Web.UI.WebControls.GridView" adapterType="CSSFriendly.GridViewAdapter" />-->

Does anyone have a solution?

Nobles350
Asp.Net User
Re: GridView Adapter with PagerTemplate broken4/16/2007 4:57:02 PM

0/0

I'm having the same problem. I've yet to find a solution.

dustyreagan.com
whatispunk
Asp.Net User
Re: GridView Adapter with PagerTemplate broken4/16/2007 8:31:12 PM

0/0

This same problem exists with the FormView control as well.

 

A fix would be greatly appreciated! 


Simple minds think alike. Great minds come up with something different.
alvinling
Asp.Net User
Re: GridView Adapter with PagerTemplate broken5/18/2007 8:13:26 PM

0/0

The code below works but there's still a problem with skinned controls rendering properly (regular server controls render fine)

  

private void WritePagerSection(HtmlTextWriter writer, PagerPosition pos)
{
    GridView gridView = Control as GridView;

    if (gridView != null && 
        gridView.AllowPaging && 
        gridView.PageCount > 1 && 
        (gridView.PagerSettings.Position == pos || gridView.PagerSettings.Position == PagerPosition.TopAndBottom))
    {
        string className = "AspNet-GridView-Pagination AspNet-GridView-";
        className += (pos == PagerPosition.Top) ? "Top " : "Bottom ";
        if (gridView.PagerStyle != null)
        {
            className += gridView.PagerStyle.CssClass;
        }
        className = className.Trim();

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

        if (gridView.PagerTemplate != null)
        {
            PlaceHolder container = new PlaceHolder();
            gridView.PagerTemplate.InstantiateIn(container);
            container.DataBind();
            container.RenderControl(writer);
        }
        else
        {
            Table innerTable = null;
            if ((pos == PagerPosition.Top) &&
                (gridView.TopPagerRow != null) &&
                (gridView.TopPagerRow.Cells.Count == 1) &&
                (gridView.TopPagerRow.Cells[0].Controls.Count == 1) &&
                typeof(Table).IsAssignableFrom(gridView.TopPagerRow.Cells[0].Controls[0].GetType()))
            {
                innerTable = gridView.TopPagerRow.Cells[0].Controls[0] as Table;
            }
            else if ((pos == PagerPosition.Bottom) &&
                (gridView.BottomPagerRow != null) &&
                (gridView.BottomPagerRow.Cells.Count == 1) &&
                (gridView.BottomPagerRow.Cells[0].Controls.Count == 1) &&
                typeof(Table).IsAssignableFrom(gridView.BottomPagerRow.Cells[0].Controls[0].GetType()))
            {
                innerTable = gridView.BottomPagerRow.Cells[0].Controls[0] as Table;
            }

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

        writer.Indent--;
        writer.WriteLine();
        writer.WriteEndTag("div");
    }
}
 
atomiton
Asp.Net User
Re: GridView Adapter with PagerTemplate broken5/23/2007 5:26:54 AM

0/0

will this code also apply to the FormView template as well?

atomiton
Asp.Net User
Re: GridView Adapter with PagerTemplate broken5/25/2007 7:39:52 PM

0/0

In Case anyone is wondering, I was at CodePlex for the DLL for the adapters and it looks like someone is addressing that the FormView didn't have all the paging options implemented but it's being worked on now. (that was a poorly constructed sentence)

 Stay Tuned.


http://www.codeplex.com/cssfriendly/SourceControl/ListDownloadableCommits.aspx


bdemarzo
Asp.Net User
Re: GridView Adapter with PagerTemplate broken5/25/2007 9:50:43 PM

0/0

Changed 1588 has the full set of paging features for FormView and DetailsView.

Note that a few pending changes to GridView are there, but there is not yet a test page in the WalkThru. If someone wants to draft up a test page (similar to the other WalkThru test pages) please feel free to and submit it as a patch.

 


- brian
- blog: www.sidesofmarch.com
ryanrr
Asp.Net User
Re: GridView Adapter with PagerTemplate broken7/26/2007 3:54:31 PM

0/0

None of the CSS Adapters seem to handle the Templates properly. Even the above suggested fix is limited to design-time markup. It appears that simply calling the .InstantiateIn method of the Template is not enough for it to render server controls modified at run-time properly. The EmptyDataTemplate for the GridView does seem to work because it uses a different technique which I don't see being able to apply to a PagerTemplate. The DetailsView and FormView EmptyDataTemplates also have this problem (as well as their PagerTemplates).

Example (using DetailsView in WalkThru):

                <EmptyDataTemplate>

                    <asp:PlaceHolder ID="phTest" runat="server" />

                </EmptyDataTemplate>

 

    protected void DetailsViewSample_ItemCreated(object sender, EventArgs e)

    {

        ph = DetailsViewSample.FindControl("phTest") as PlaceHolder;

        if (ph != null)

        {

            Trace.Warn("Found empty data row.");

            ph.Controls.Add(new LiteralControl("testing"));

        }

    }

 

This won't display anything with the CSS adapter enabled even though the trace hits normally. CSS Adapter disabled, the row will display the correct "testing" value. This can be a real problem when you want to implement a nice, dynamic PagerTemplate.

 

I don't quite grok how templates work to suggest a solution, however.

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


Free Download:


Web:
GridView Adapter with PagerTemplate broken - ASP.NET Forums Re: GridView Adapter with PagerTemplate broken. 03-06-2007, 9:07 AM. Contact ... Re: GridView Adapter with PagerTemplate broken. 04-16-2007, 12:57 PM ...
GridView Adapter with PagerTemplate broken - ASP.NET Forums In using the CSS Control Adapters on a paged GridView, initially all worked correctly. However, as soon as I added a PagerTemplate to the ...
CSS Friendly Control Adapters on Forums - ASP.NET Forums | BoardReader Re: GridView Adapter with PagerTemplate broken - 1 new post. Started 6 days, 18 hours ago (2008-10-13 09:33:53) by bdemarzo ...
CodeProject: A very nice and complete custom GridView pager.. Free ... How to implement a custom pager for the Gridview's PagerTemplate.; ... this control with a ObjectDataSource binded to a custom written Business Adapter. ...
From igorz at mainsoft.com Sun Jul 1 07:17:58 2007 From: igorz at ... GridView. To customize the pager I'm using a?pager template and override ...... Adapter() return the given IList unchanged if it already is an ArrayList. ...
.NET ASP Page 5 - Bytes Site Map How do you make a gridview depend on a dataset that you create · ASP. ... Broken Link · How to focus a cell of a gridview inside an UpdatePanel (AJAX) ...
CodeProject: Paging a Repeater using an additional component. Free ... The best known way is writing your custom css adapter in asp.net 2.0, ... SelectedNumericPagerTemplate, Next and Previous PagerTemplate and so on. ...
Untitled In this architecture, the application is broken into three parts: ... For example, you can use a GridView control to present data from a database ...
ASP.NET Development Mar 18, 2006 ... Asp.NET Composite Control with GridView, RowCommand doesn't work ... Visual Studio 2005 and SQL Adapter Wizard ...
microsoft.public.dotnet.framework.aspnet questions about formatting gridview at runtime, Adam Sandler; Help with ROWSPAN in table/grid ...... Re: Issue with ASP 2's Table Adapter Wizard, David Wier ...




Search This Site:










a son of a challenge: xml file feeding menu on master page, and changing ajax update panel in content??

navigating to and from https and http pages

storing password

gridview data based on user login

convert to date-time

shopping portal

..also bought

dnn with xp sp2 rc1 not connecting to sql/msde

master page sample

vwd - the dollars

the assembly version does not match the database version

postback counter in viewstate

add role when new user is created

newbie dnn 3 developer question ¿how can i obtain the language key use for the actual user?

why was the download removed from the web site?

how to publish with 'app_data' folder

hide nodes from the menu

cskdb.cmd can't access database

mybase.frameworkinitialize error with global master page.

https help

evaluating hosting...

windows user

team solution for developing applications in visual studio (2005 or 2008)

how can the telerik themes be applied to a control inside dnn w/o coding attribute properties in codebehind?

sitemap and role based access(custom roles)

is sqlserver required (vwd beta2)

multiple blog login problem

microsoft.web.ui.webcontrols.dll is not valid type library

image placeholder 3.0.11

whether to contruct a posting table or tables ...

 
All Times Are GMT