|
How do I print information displayed on a gridView or inside a panel for example with either server script or client script without printing the whole page.
I use window.print() method but the whole page is printed out, I don't want that. I want a specific region of my .aspx page.
Thank you all.
Tunsten
|
|
|
|
|
Hi
You can create a new window on client side.
var pp = window.open('', '', 'left=0,top=0,toolbar=0,scrollbars=1,status=1');
and use innerHTML property to insert print text or html
pp.document.body.innerHTML += cPrint;
after that use window.print() for new window
Mohammad Khansari
|
|
|
|
|
But I don't seem to get you write. I mean to print out specific area (maybe information displayed on a DIV tag for example) from the page.
Tunsten
|
|
|
|
|
hi
Here is complete code
var pp = window.open('', '', 'left=0,top=0,toolbar=0,scrollbars=1,status=1');
pp.document.body.innerHTML += cPrint;
pp.document.close();
pp.focus();
pp.print();
I think that it works properly
Mohammad Khansari
|
|
|
|
|
Hello everyone,
How do I get the ID of a server control with JavaScript code?
I am trying to do client-side validation with JavaScript before it's processed on the server, the code I used didn't work and I did't get error. Below is the code I used:
// the JavaScript function
function ValidateAssetCategory() {
var catID = document.getElementById("txtCatID").value;
if (catID == null) {
alert("Please enter category ID");
return false;
}
}
// the aspx source code
<asp:LinkButton ID="lbSave" runat="server" OnClientClick="ValidateAssetCategory();" onClick="lbSave_Click">Save</asp:LinkButton>
only the server code is executed.
Thanks for your understanding...
Tunsten
|
|
|
|
|
tunsten wrote: var catID = document.getElementById("txtCatID").value;
As you have said you need to get ID of Server Side Control, you have to do the following :
Var CatClientID="<%=txtCatID.ClientID%>"
function ValidateAssetCategory() {
var catID = document.getElementById(CatClientID).value;
if (catID == null) {
alert("Please enter category ID");
return false;
}
}
Hope this will help you.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I did it but the client script still didn't work. How I am I suppose to put the server script? I used
<asp:linkbutton id="lbSave" runat="server" onclientclick="ValidateAssetCategory();">Save
what other option please?
Tunsten
|
|
|
|
|
document.getElementById("<%=txtCatID.ClientID%>").value
|
|
|
|
|
then, how do I code the linkbutton?
is it
<asp:linkbutton id="lbSave" runat="server" onclientclick="ValidateAssetCategory()" onclick="lbSave_Click">
if it is, I have tried it but did not work. only the server script (lbSave_Click) is executed.
help me out.
Tunsten
|
|
|
|
|
Just replace
<asp:LinkButton ID="lbSave" runat="server" onClientClick="ValidateAssetCategory()" onClick="lbSave_Click" />
with
<asp:LinkButton ID="lbSave" runat="server" onClientClick="return ValidateAssetCategory()" onClick="lbSave_Click" />
And from your Javascript function ValidateAssetCategory return true if you need server side to execute, otherwise put false.
function ValidateAssetCategory()
{
if(...) return true;
else return false;
}
Cheers.
|
|
|
|
|
It works fine now with your guide. Thanks.
Tunsten
|
|
|
|
|
Hi
I think that you write "ValidateAssetCategory" function out of your aspx page
If It's not out of your page please excuse me
Mohammad Khansari
|
|
|
|
|
yes... from a .js file and it didn't work. but I got it working when I inserted into my .aspx file. Thanks.
Tunsten
|
|
|
|
|
Hi dev team,
I need to display details of a selected item from a gridView control as a popup either on a DIV tag or on another page populated with JavaScript (this means; the keyfield would be passed as a QueryString object to the popup page) code.
Anyone with sample source code please?
Tunsten
|
|
|
|
|
You can do it easliy during GridView RowDataBound Event.
<br />
void SampleGridView_RowDataBound(object sender, GridViewRowEventArgs e)<br />
{<br />
if (e.Row.RowType == DataControlRowType.DataRow)<br />
{<br />
}<br />
}
I have just given you the hint. . Now hope you can go ahead. Please let me know if you need more help.
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Yes I need more help on what the JavaScript code could look like, please.
Thanks in advance.
Tunsten
|
|
|
|
|
Just to confirm one thing, You want popup tobe open on row selection or by clicking of any of the control of that row.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
on row (the ID/keyfield of the row) selection
Tunsten
|
|
|
|
|
Hi peoples,
i m trying to send an mail from my application (localhost)
this is my code..( i copied from website)
// Command line argument must the the SMTP host.
SmtpClient client = new SmtpClient("localhost");
// Specify the e-mail sender.
// Create a mailing address that includes a UTF8 character
// in the display name.
MailAddress from = new MailAddress("hbairavan@yahoo.com", "Jane " + (char)0xD8 + " Clayton",
System.Text.Encoding.UTF8);
// Set destinations for the e-mail message.
MailAddress to = new MailAddress("hbairavan@yahoo.com");
// Specify the message content.
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(from, to);
message.Body = "This is a test e-mail message sent by an application. ";
// Include some non-ASCII characters in body and subject.
string someArrows = new string(new char[] { '\u2190', '\u2191', '\u2192', '\u2193' });
message.Body += Environment.NewLine + someArrows;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.Subject = "test message 1" + someArrows;
message.SubjectEncoding = System.Text.Encoding.UTF8;
// Set the method that is called back when the send operation ends.
client.SendCompleted += new
SendCompletedEventHandler(SendCompletedCallback);
// The userState can be any object that allows your callback
// method to identify this send operation.
// For this example, the userToken is a string constant.
string userState = "test message1";
client.EnableSsl = false;
client.UseDefaultCredentials = false;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials =
new System.Net.NetworkCredential(from.ToString(), "f00bar");
client.SendAsync(message, userState);
after this line am getting exception that
failure sending mail..
wat may be the reason.please help
\
thanks in advacnce
|
|
|
|
|
Hema Bairavan wrote: // Command line argument must the the SMTP host.
SmtpClient client = new SmtpClient("localhost");
You have putted "localhost" as your SMTP Server name. I guess this is wrong. Does your SMTP Server configured properly. What is the name of the Server ?
Try This link.
http://support.microsoft.com/kb/323436[^]
Hema Bairavan wrote: after this line am getting exception that
failure sending mail..
Please check your server configuration as I have suggested. Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi,
If you are sending your mail via system.net.mail. you should use smtp server ip or smtp server name and should be configured properly on server.
Farogh Haider
Web developer
|
|
|
|
|
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'CrystalDecisions.Enterprise.Framework, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 44: <add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
Line 45: <!--<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>-->
Line 46: <add assembly="CrystalDecisions.Enterprise.Framework, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
Line 47: <add assembly="CrystalDecisions.Enterprise.InfoStore, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
Line 48: <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Assembly Load Trace: The following information can be helpful to determine why the assembly 'CrystalDecisions.Enterprise.Framework, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
how to resolve this problem
|
|
|
|
|
It Seems the problem is related with the missing DLL. Does crystal reports installed on the server ? Please verify do you have "CrystalDecisions.Enterprise.Framework.dll " in your Server GAC or not.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 21: <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
Line 22: <assemblies>
Line 23: <add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
Line 24: <add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
Line 25: <add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
Source File: C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\WebSites\mhms\trunk\MHMS\hms_my\web.config Line: 23
Assembly Load Trace: The following information can be helpful to determine why the assembly 'CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded.
|
|
|
|
|
Dear Friend,
I have one control DIVSION (Server side) on more then 20 forms, i am using that control as Error Message or Successful message control all working fine but now i want that control work dynamic as if there is error message it should show message in red coloured and so on...
I know i can manually go each and every control and set this but i want to handle it with some smart way by using base class of that form but don't know how to capture Error and Successful message, can any one help me regarding the same
Thanks and Regards
Sasmi
|
|
|
|