CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 7/23/2004 7:19:22 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 5 Views: 79 Favorited: 0 Favorite
6 Items, 1 Pages 1 |< << Go >> >|
bprussell
Asp.Net User
Overriding the Render() Method7/23/2004 7:19:22 PM

0

I have a custom server control that I am trying to add a LinkButton to, like so:

public override void Render(HtmlTextWriter output) {

LinkButton lb = new LinkButton();
lb.Text = "Testing";
lb.Command += new CommandEventHandler(lb_Click);
lb.CommandArgument = "This is working";
lb.ToolTip = "The mouse is over the linkbutton";
lb.Enabled = true;
lb.RenderControl( output );

}

private void lb_Click(object sender, CommandEventArgs e) {

Parent.Page.Response.Write( e.CommandArgument );

}

The result is that the linkbutton is displayed, and the tooltip appears on mouseover, but the link is not active. In other words, all of the html is emitted except for where there would normally be href="javascript:__doPostBack( ... )". Why is the postback portion of the html not being emitted?
AndrewSeven
Asp.Net User
Re: Overriding the Render() Method7/24/2004 4:04:25 PM

0

Try moving :
LinkButton lb = new LinkButton();
and
lb.Command += new CommandEventHandler(lb_Click);

out of the Render method and into the constructor or OnInit

try using the Click event instead of Command...
master4eva
Asp.Net User
Re: Overriding the Render() Method7/25/2004 8:03:47 AM

0

:: Why is the postback portion of the html not being emitted?

Reason: the Render stage is there to send content to the browser. Not to make decisions at that point. If you want to extend Andrew's advice, you can read on how to create composite controls which will solve your problem:

http://aspalliance.com/359

However, I am gettting the hint that you want to extend the control. You can read more information over here:

http://aspalliance.com/350
-- Justin Lovell
bprussell
Asp.Net User
Re: Overriding the Render() Method7/26/2004 8:31:22 PM

0

I'll cut to the quick on this one. I'm trying to extend the pager on the ASP DataGrid to be more Google-like. Now, I have seen plenty of articles on how to extend the pager, and I have been able to do it on a plain old ASP DataGrid on a page, but i am having a hard time actually extending it into a reusable server control.

A user control is not appropriate in this case since the databinding logic must be done in HTML view.

So, I'm trying to emit linkbuttons for the page numbers and "<< Previous" and "Next>>", etc. So yeah, I looked over those articles and they didn't seem to apply in this case. I tried overriding the CreateChildControls method and I got the same result. Any other ideas?
AndrewSeven
Asp.Net User
Re: Overriding the Render() Method7/27/2004 12:06:37 AM

0

I've been slowly drilling down on the pager/paging problems.

In the last implementation, I built a templated class for the pager.
In fact, I use a DataList control as the base for the pager. This gives me a complete set of templates for the first last and page numbers.
Based on the number of pages, I create an array list which is used for the datasource of the DataList.

The actual DataGrid/List/Repeater (any BaseDataList) does not know about real data, only the pager does. BaseDataList was a need, because the Designers don't like DataGrids.

The pager has a property for the ID of the ControlToBind aswel as a LoadData/LoadPagedData event.

In use:
Pager1.ControlToPage = DataGrid1;
Pager1.PageSize = 20;
Pager1.OnLoadData += new DataPagerLoadDataHandler(...)

Inside the pager, when it is databinding, it trims the data down to the current page, sets the datasource of the ControlToBind and calls Bind on it.

The whole things gets pretty complex, only showing 5 page numbers, optionaly supporting a datasource that does it's own paging...maybe I should write an article :S

bprussell
Asp.Net User
Re: Overriding the Render() Method7/28/2004 4:09:37 PM

0

I found a solution to the pager problem, and it doesn't involve the Render method. Instead, I overrode the OnItemCreated method and accessed the pager like so:

protected override void OnItemCreated( DataGridItemEventArgs e ) {

ListItemType itemType = e.Item.ItemType;

if( itemType == ListItemType.Pager ) {

// Capture the table cell that contains the pager
TableCell pagerCell = e.Item.Cells[ 0 ];

}

}

Once you do this, then you can add whatever you want to that TableCell by calling the pagerCell.Controls.Add() method. It worked like a charm!
6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Professional ASP.NET 2.0 Server Control and Component Development Authors: Shahram Khosravi, Pages: 1186, Published: 2006
Professional Web Parts and Custom Controls with ASP.NET 2.0 Authors: Peter Vogel, Pages: 449, Published: 2005
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Developing Microsoft ASP.NET Server Controls and Components Authors: Nikhil Kothari, Vandana Datye, Pages: 689, Published: 2002
.NET Programming 10-minute Solutions: 10-Minute Solutions Authors: A. Russell Jones, Mike Gunderloy, Pages: 433, Published: 2004
ASP.NET Solutions: 24 Case Studies : Best Practices and Design Patterns for Developers Authors: Richard C Leinecker, Pages: 0, Published: 2003
Pro ASP. Net 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008
ASP.NET Kick Start: Kick Start Authors: Stephen Walther, Pages: 624, Published: 2002
ASP.NET AJAX Programmer's Reference: With ASP.NET 2.0 Or ASP.NET 3.5 Authors: Shahram Khosravi, Pages: 1522, Published: 2007

Web:
Rendering an ASP.NET Server Control In the simplest case, a control author can override Render to pass HTML (or other markup content) as a string argument to the Write method of an instance of ...
Control.Render Method (System.Web.UI) When developing custom server controls, you can override this method to ... The following example overrides the Render method, using the HasControls method ...
David Klein's Corner: Issues when Overriding the Render() method ... Mar 5, 2008 ... Issues when Overriding the Render() method of a asp:Textbox. The framework at my current client has had a bug which has been sitting around ...
Override Render - adding user control Default Override Render - adding user control. I'm trying to add a user control to a form via the pages render method and I ...
overriding the CheckBoxList render method - ASP.NET Forums I want to override the render method of the asp CheckBoxList so that I can print out any type of list. I create my own check boxes to render ...
Override Render method in Label Control Talk about Override Render method in Label Control.
Visual Studio Magazine Online | Practical ASP.NET: Let Users Save ... Page and then override the Render method. The override provides a standard header and ... The Render method's override requires only a couple lines of code : ...
Override Render method not triggering | Tech Off | Channel 9 Aug 1, 2007 ... I have .aspx page and .ascx page. There is a gridview inside .ascx page. Gridivew is inside AJAX Update panel.When i load page for the first ...
Override Render method in Label Control - .NET ASP Override Render method in Label Control. Get answers to your questions in our . NET ASP forum.
Creating Usable Page Templates in ASP.NET When you use inheritance to override the Render method, ... All in all, overriding the Render method by itself does not scale well and is a readability ...

Videos:
Injustice? A short film for people to reflect, especially for muslims at a time when Islamaphobia is growing... There is one word that captures the essence of ...
MOSAIC: World News from the Middle East August 24, 2005 The Peabody Award-winning Mosaic features selections from daily TV news programs produced by national broadcasters throughout the Middle East, transl...
spOtlight: Map Your Kitchener @ Artery Gallery From Friday June 6th through Sunday June 8th, spOtlight featured over 100 free activities presented by more than 250 artists throughout Kitchener, Wa...
django: Web Development for Perfectionists with Deadlines Google TechTalks April 26, 2006 Jacob Kaplan-Moss ABSTRACT Django is one of the premier web frameworks for Python, and is often compared to Ruby-on...
Santa Monica Council Meeting Santa Monica Council Meeting






friends/private messaging module needed

language selector module for dnn 3.0.12

dnn 3.1.1 multi portal user sharing (portal unique not host) solution

some dnn projects coming on line

dnn3 web cam module

new skin: high tech grey (dotnetnuke xxl 10 only)

try dotnetnukedocs.com

parent/child portal users (need to be the same)

dotnetnuke api help

article: ajax

tourism site skin

dotnetnuke presentation resources

anyone have problems with lynxchecker module for dnn3?

looking for custom design work

dotnetnuke.com skin

trying to install dnn 3.1 on godaddy

transparent menu

dotnetnuke host?

new skin: clouds (something very different)

change language on the fly, also for content?

help build the ultimate dnn support site

willowtree software announces the launch of dnn hosting services

which web host??? ts? whfl?

solpart menu

forms and survey...

i created a german dotnetnuke help site

free skin; technical and documentation style.

language

visibility displaying when turned off in the module settings.

is there a telerik r.a.d. menu module?

   
  Privacy | Contact Us
All Times Are GMT