CodeVerge.Net Beta


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

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 7/19/2005 5:37:32 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 71 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
steveba
Asp.Net User
Using a div tag in a composite control7/19/2005 5:37:32 PM

0/0

I have seached the forum, and still not sure how to do this. I have a composite custom control that houses a DataGrid, Label, and a button. The page that will be using this control has javascript on it that only prints what's in between the div tag id = "div1". The problem is, that I only want the DataGrid to print and not the button directly underneath, only I'm not sure how to dynamically add a div tag with an id. Currently, the div tag is on the actual page using the control, and houses the whole custom control, thereby printing the button as well.

javascript looks like:

function CallPrint() {var strid = "div1" var prtContent = document.getElementById(strid); var WinPrint = window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0'); WinPrint.document.write(prtContent.innerHTML); WinPrint.document.close(); WinPrint.focus(); WinPrint.print(); WinPrint.close();}   function CallPrint() {var strid = "div1" var prtContent = document.getElementById(strid); var WinPrint = window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0'); WinPrint.document.write(prtContent.innerHTML); WinPrint.document.close(); WinPrint.focus(); WinPrint.print(); WinPrint.close();} 

and the shortened version of the custom control looks like:

public class AssignedStoresControl : System.Web.UI.WebControls.WebControl, INamingContainer

{

Label lblError = new Label();

DataGrid dgAssn = new DataGrid();

Button btnRemoveAssn = new Button();

protected override void CreateChildControls()

{

//Label

this.lblError.ForeColor = System.Drawing.Color.Red;

this.lblError.CssClass = "smaller2";

//DataGrid

dgAssn.AutoGenerateColumns = false;

//Button

btnRemoveAssn.Text = "Remove Assignments";

btnRemoveAssn.CssClass = "btn";

this.btnRemoveAssn.Click += new System.EventHandler(btnRemoveAssn_Click);

this.Controls.Add(lblError);

this.Controls.Add(dgAssn);

this.Controls.Add(btnRemoveAssn);
}
etc.

MLibby
Asp.Net User
Re: Using a div tag in a composite control7/19/2005 8:43:01 PM

0/0

You should be able to do this with client-side java script.  When the user presses print your client will need to iterate through all controls on the page looking for buttons.  For each found button set its style.display to none.

The code should look something like this...

var btns = document.body.getElementsByTagName("input");

for (n=0; n<btns.length;n++)
{
   // verify this is the right button
   if (btns[ n ].name == "SomeNameSetInYourControl")
   {
       btns[ n ].style.display = 'none';
   }
}

Redisplay the buttons as follows...
btns[ n ].style.display = '';

Mike


- Cache entire web sites at the client and server and keep cache current. Cache just got easier!
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
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
Professional C# 2005 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Allen Jones, Pages: 1540, Published: 2006

Web:
How to render composite control inside DIV tag - ASP.NET Forums Re: How to render composite control inside DIV tag ... Try adding this code (I'm using VB.NET):. Protected Overrides ReadOnly Property ...
How to Build a Custom WebControl using CompositeControl — Patrick ... These Properties can be set at design time in the markup tag, or in the PropertyGrid when the composite control is selected. ...
CustomControls inherented from CompositeControl allways have as ... example to div in the constructor of the control ... inherented from CompositeControl allways have as tag span - how to change this ...
Custom Templated CompositeControl/CompositeControlDesigner you see fit (eg. convert to div tag layout), but if you remove ... have the ability within our CompositeControl/CompositeControlDesigner to ...
Custom Templated CompositeControl/CompositeControlDesigner you see fit (eg. convert to div tag layout), but if you remove or rename ... Using a custom server control declaratively in a user control ...
Custom Templated CompositeControl/CompositeControlDesigner ASP Net - Custom Templated CompositeControl/ ... you see fit (eg. convert to div tag layout), but if you remove or rename the ...
Using WebControls in a Composite Server Control using Atalasoft.Imaging.WebControls.Annotations; ... This constructor ensures that the composite control is rendered as div tag ...
aspnet webcontrols CSS class for a div tag 12/9/2005 6:22:41 AM CSS class for a div tag. Hi, Hoping someone can help me. I= B4m building a composite control and there is one thing I ...
Loading Postback data for a composite control : postback ... Tags: postback, composite, control, data ...
... using System.Web.UI; public partial class _Default :Page ...
Server Control Tips & Tricks Composite control that wraps DataGrid; Simply adds
tag. Great candidate for a server control. Cleaner HTML; No messy
tags in design code ...




Search This Site:










adding custom templates to the repeater control and using the template on some of the databound-items

should i install these updates on my web server?

absolute positioning

building a textbox control that allows a maxlength.

host recommendations

control with a group of nested controls?

how do i set image width/height generated by imagegenerator programatically in imagegenerator code?

web user control - persisting state accross postback

user controls in templates

error on loading control

custom nested collections in properties window

'' could not be set on property 'userinfos'

multi-level user control design time properties....

designer attribute problem

custom datagrid

heavy expences to operative memory on asp.net hosting

deprecated apis in control designer

onbubbleevent from dynamically added templates containing buttons not firing.

how do i change the default tagprefix for custom controls?

rendering problem

project root path at design time???

metering & billing

postback counter in viewstate

webcustomcontrol and dynamic control

simple question regarding server controls and toolbox

setting the left and top style properties while in design mode.

need help with using out parameter

extend datagrid by wrapping with another control

control submission question

update scans

  Privacy | Contact Us
All Times Are GMT