|
I hope the following article may help u out
Ever wanted to print a DataGrid alone from an ASP.NET Web page? Put an <asp:DataGrid> tag inside the tag does the trick. Here are the steps involved:
1. Enclose the <asp:datagrid></asp:datagrid> tag inside the <div></div> tag.
2. Write a JavaScript function which takes care of printing the content from <div> tag.
Here's an example:
<script language=javascript>
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=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();
prtContent.innerHTML=strOldOne;
}
</script>
<div id="divPrint">
<asp:datagrid>
.....
.....
.....
</asp:datagrid>
</div>
<asp:button ID="btnPrint" onClick="javascript:CallPrint('divPrint');" Runat=Server />
Everything Is Possible!
|
|
|
|
|
I have a webform whereby i use a dropdown list to select fields like title,province etc. but the problem is that when i select a value from the dropdown and click save button,the field in the database becomes blank.
my code is as follows:
BUSINESS LAYER
Public Function GetTitle() As Data.DataSet
Dim strSQL As String
Dim obj As Datalayer.Database = New Datalayer.Database
'strSQL = "Select * from UserProfile with (nolock) where UserName='" & strUserName & "' and Status = 'A'"
strSQL = "Select TitleID, Title from Title1 with (nolock) "
GetTitle = obj.GetDataSet(strSQL)
obj.Close()
Exit Function
End Function
PRESENTATION LAYER
Private Sub LoadTitle()
Dim ds As New Data.DataSet
Dim objdata As Businesslayer.Contractors = New Businesslayer.Contractors
ds = objdata.GetTitle
cbotitle.DataSource = ds
cbotitle.DataBind()
cbotitle.Items.Add(New ListItem("Select...", ""))
cbotitle.Items.Item(cbotitle.Items.Count - 1).Selected = True
End Sub
BUTTON SAVE
Dim obj As Businesslayer.Contractors = New Businesslayer.Contractors
Dim ds As Data.DataSet
ds = obj.Getcontractor(txtfirstname.Text)
obj.AddContractor(txtID.Text, cbotitle.SelectedItem.Value, cbogender.SelectedItem.Value, txtfirstname.Text, txtlastname.Text, _
txtIDNumber.Text, txttel.Text, txtcell.Text, txtfax.Text, txtemail.Text, _
cbodepartment.SelectedItem.Value, txtlocation.Text, txtcity.Text, txtpostal.Text, txtoccupation.Text, cbomtype.SelectedItem.Value, _
cboprovince.SelectedItem.Value, txtpassport.Text)
UserMsgBox("Successfully add")
Karabo Mekgwe
|
|
|
|
|
the field in the database becomes blank.?
you mean. the selected value doesn't store in database.
some tips.
1. Set the breakpost in Button Save. Check the selected value of combobox.
2. Check whether you got any value (eg: paraProvince) in Businesslayer.Contractors.AddContractor() function. [Make ensure that all values of parameters has been passed from Presentation Layer to BusinessLayer.]
3. Check the SQL Statement.. [Make ensure that all values of parameters has been passed from BusinessLayer to DataLayer.]
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you.
|
|
|
|
|
HI all,
I need a help for printing the content of the page displayed in the webpage
using vb.net
Can anybody help
I will be very very pleased if i get answer
|
|
|
|
|
You need a client side script like:
window.print()
you can check this link:
http://www.javascriptkit.com/howto/newtech2.shtml
|
|
|
|
|
Hi
I am having 2 html pages
a.html and b.html
In a.html I am having a tag
go
Then in b.html how can we retrieve the value of querystring in b.html
only in javascript(not in asp or .net)
Thanks
Karan
|
|
|
|
|
a.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<p><a href="index.htm?id=1982">New Page 1</a></p>
</body>
</html>
b.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script language=javascript>
function chkQueryString(){
document.getElementById('myid').innerHTML = "Result : " + getQueryVariable('id');
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
alert('Query Variable ' + variable + ' not found');
}
</script>
</head>
<body onload="chkQueryString();">
<div id="myid">
</div>
</body>
</html>
Hopefully. it would help.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you.
|
|
|
|
|
i have a usercontrol and there is a datalist and one imagebutton is there in datalist.when i am clicking on image button inside the datalist then itemcommand is not firing.plzz help me to solve this probs.
tbhattacharjee
|
|
|
|
|
use "LinkButton" instead of button..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you.
|
|
|
|
|
i have given inetmgr in run my iis opened .I created one virtualDirectory and placed one.html and one.aspx files with same content.
i am able to run one.html from browser .
but i am getting page can't be displyed error for one.aspx page.
My main problem http://localhost couldn't display default server page .
So pls tell me what i have to do.
Thanks inAdvance.
|
|
|
|
|
Hi,
1. If you are adding any .aspx, that file should be a valid .aspx file. i.e Page should have '<% @Page Language='C#' %>. Otherwise it will not display.
2. If the page is valid then you need to set default page.
Open Inetmgr -> Right Click your web application -> Go to second tab 'Documents' -> Remove all files from the list -> And add your default page name.
3. If application files are in main folder (i.e wwwroot/inetpub) .. then it can be accessed using the link 'http://localhost.
4. If in some other folder then 'http://<virtual directory> (make sure that you have added default document as given in step 2).
Hope this helps.
Harini
|
|
|
|
|
Check and make sure that C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll is assigned to the Aspx extention in you application mapping dialog. You may have not installed .NET
nothing
|
|
|
|
|
in the databound gridview i want a hyperlink . on click of which it should go to another form carrying a querystring.
urgent !!
thanks in advance
|
|
|
|
|
To accomplish this you need to override the Gridview OnItemDatabound.
Then find your Hyperlink control and set his NavigateURL to your desired databound field from the parameter “e”.
Can you tell us what you have done or accomplished. This will help us to determine what particular problem/mistake you have.
Regards,
Mark
|
|
|
|
|
Or your can use a HyperLinkField and have the grid view do it all for you
|
|
|
|
|
Hello all,
I am new to .net, m developing a small application, the problem i face is whenever there is a postback on my page the font size of the whole page increases. How can i avoid this ??
Any help would be appreciable.
Thanks in advance.
Deepak
|
|
|
|
|
Strange !!! Never Seen
Have you writen any code in Post back ?
<l>Thanks and Regards
Sandeep
|
|
|
|
|
Hi Deepak,
If font size increases after postback, it means there is some javascript error.
If it so, but how to check?? Then double click on the left corner of your web browser. (Instead of text 'Done', text 'Done with some errors' will be displayed if there is an error in your .aspx). Error may be syntax error or Braces not enclosed etc...
Check it now. Hope you got it.
- Harini
|
|
|
|
|
May be the possible cause of this problem is you have improper html tags, I mean no closing tags.
How will this happen.
1.You have a literal control then you set his value to this Literal1.Text =”<H1>My H1” when page load was trigger.
2.You have a label and you set his value to this Labe1.Text = “This is a <B>Bold”.
3.GridView or Datagrid Item has a HTML value with no closing Tags.
4.You have generated a DHTML code with no closing Tags. Eg. InnertHTML or OuterHTML.
I think there are much more reason out there.
Check your browser view code now to verify if your HTML conform to HTML standards or XHTML.
Regards,
Mark
|
|
|
|
|
do you hav firebug installed in your firefox browser?
if you dont have then maybe you can install this extension..
this is really powerful tools for web development. you can use this tool for debugging javascript, logging, inspecting HTML DOM and CSS...
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you.
|
|
|
|
|
Click on the View Tab of the Internet Explorer
then, Select the Text size to Medium.
Hope this will help you out of your problem.
Regards,
Suresh Dayma
Everything Is Possible!
|
|
|
|
|
Often times, in my world, this occurs when you have a response.write() sort of deal in your code on postback() that is breaking the intended render of your page.
Check to be sure your postback debugging sort of response/writes aren't causing the issue.
Best of Luck,
Bill Dodd
bill.dodd{at}gulf-technology.com
Gulf Technology
www.gulf-technology.com
|
|
|
|
|
I had this same problem. Issue was caused by a post back that involved a response.write()(or-not). I resolved the issue by changing my 'Font-Size' from 'large' to an actual integer such as 16, or from 'small' to '10'
|
|
|
|
|
when we get an error how we can store that in sqlserver database
|
|
|
|
|
Write a Logger class and a static method to store log details.
In the business layer, you can call this method when exception occurs(inside catch block)
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|