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.