Convert Webpage to PDF
How to Convert the webpage to PDF. There is a question asked in forums by most of the members.
Here the some methods that will be help you.
There are number of ways to do...,
1) using ITextSharp
2) Make the webpage as Image and add it to PDF ( proposed by Charith - Thanks anyway)
Check the forums discussion here
3) Using some online tool like this HTML to PDF
4) If the User want a link on the webpage so if the user click the link , current page is converted to PDF.
Check this: http://www.pdfspot.com/
Thanks
Here the some methods that will be help you.
There are number of ways to do...,
1) using ITextSharp
2) Make the webpage as Image and add it to PDF ( proposed by Charith - Thanks anyway)
Check the forums discussion here
3) Using some online tool like this HTML to PDF
4) If the User want a link on the webpage so if the user click the link , current page is converted to PDF.
Check this: http://www.pdfspot.com/
Thanks
Post Method - Example Code
Here I am going show : how to post the data from one page to another page using POST Method.
Here is the Simple example.
P1.aspx
So if you are going to use post method on form tag set method="post" and action="p2.aspx" ie: designation url to get the data of p1.aspx on p2.aspx.
P2.aspx
Here is the Simple example.
P1.aspx
<form id="form1" runat="server" method ="post" action ="p2.aspx">
<div>
User : <asp:TextBox ID="txtName" runat="server"></asp:TextBox><br/>
Password : <asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
<asp:Button ID="btnSend" runat="server" Text="Send" PostBackUrl ="~/p2.aspx" />
</div>
</form>
So if you are going to use post method on form tag set method="post" and action="p2.aspx" ie: designation url to get the data of p1.aspx on p2.aspx.
P2.aspx
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</div>
</form>
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = Request.Form["txtName"].ToString ();
TextBox2.Text = Request.Form["txtPassword"].ToString ();
}
Finally on destination page
using Request.Form["yourcontrolid"] to get value of the control on p1.aspx
Configure the Google Map API key for Multiple domains
Posted by Venkat |
Labels:
ASP.Net,
Google Map
Recently I am looking in to the issue.. how to configure the google map API key for the Multiple Domains.
In my case i have two domains : Create a Google MAP API key for the Two Domains
Example:
So use this Javascript instead of your previous Javascript
So try the above script - this will work for multiple domains.
Ref:
http://groups.google.com/group/google-maps-api/browse_thread/thread/3c300b5be6b5cad7/77037ee6035f2c84?lnk=gst&q=multiple+domains#77037ee6035f2c84
In my case i have two domains : Create a Google MAP API key for the Two Domains
Example:
'domain1.com' : 'api-key-for-domain1'
'domain2.com' : 'api-key-for-domain2'
So use this Javascript instead of your previous Javascript
<script type="text/javascript">
var strKey = "";
switch (window.location.host)
{
case 'domain1.com':
strKey = 'ABsdfQIAA34AArNH17caPfR3kIylWMznsdfh3xTfvmRwsdfsd6dRB3osdfVmrrtfPwNADfaZlxQgtqbBp4xswSjiA0KYuB2Y2ynaUQ';
break;
case 'domain2.au':
strKey = 'Agbs42BQIAdfsAAArNH17caPfdfdfR3kIylWMfsdznh3xRosdfqCxgZKzqbnVvUHRgAMBYHaL-QhSwZqznIVtPbMQt4wrboRbFET9LYQ';
break;
}
document.write('<'+'script src="http://maps.google.com/maps?file=api&v=2&key='
+ strKey + '" type="text/javascript">' + '<'+'/script>');
</script>
So try the above script - this will work for multiple domains.
Ref:
http://groups.google.com/group/google-maps-api/browse_thread/thread/3c300b5be6b5cad7/77037ee6035f2c84?lnk=gst&q=multiple+domains#77037ee6035f2c84
How to check the specific field in the row has contain null or value.
Good Morning after a month I spend the time to post the small tips who already known but i would like to share this post which everyone come to know.
Question : how to check the specific field in the row has contain null or value.
Normally we used to get the data from the DB using specific id for ex: get the specific user details using his userid. So it will return that row value. In that row some field may contain NULL value.
Here is the code to check the particular field contains value or null.
In my case I am getting the row from Database and assigned to the Datarow like this
Dim dr as DataRow dr = ds.Tables(0).Rows(0)
Here the dr contains the row data from this I am checking the field.
Datarow contains a method called IsNull to check whether the field has null or value.
EX:
if (dr.IsNull("fieldname")) then ' if the field contain null do the manipulation here else ' the field cotains some value. End if
the above code defines the Datarow contain a method called IsNull which is going to check the whether the specified fieldname has value or null as per we can manipulate it.
And also I am going to tell another tips which was pointed @ DotnetCurry.com here - thanks for that.
IE: if we are going to display user photo on Gridview where user have to upload his photo which will be an optional, User may or may not upload his photo, at that time the user who don't have photo on DB , the Gridview shows the cross mark image for that user. This is not good in practice from user point of view instead we have to show the default image for the user who don't have photo on DB.
Example:
on the HTML img tag write like this
< img src="Dynamic-imagename" onerror="this.src='../images/NoImageFound.jpg'" .. / >
This above tag will show the user photo who have photo on DB if there is no photo on DB for those it shows the default image specified on onerror event.
Read or Write Session value on HTTP Handler file (.ashx)
How to use Session (ie: read or Write) on HTTPHandler file ie: .ashx file ?
I noticed some post on forums how to get the Session value on (.ashx file). So here is the solution.
By Default if you use Session on handler, the session returns null value. You have to implement the interface to read or write session value on handler file. If there is a situation to read Session value on your Handler file implement IReadOnlySessionState.
When there is a case, you have to read or write session value in Handler file.
Implement IRequireSessionState.
Here is the code where i implement both IReadOnlySessionState and IRequireSessionState.
Example:
I noticed some post on forums how to get the Session value on (.ashx file). So here is the solution.
By Default if you use Session on handler, the session returns null value. You have to implement the interface to read or write session value on handler file. If there is a situation to read Session value on your Handler file implement IReadOnlySessionState.
When there is a case, you have to read or write session value in Handler file.
Implement IRequireSessionState.
Here is the code where i implement both IReadOnlySessionState and IRequireSessionState.
Example:
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using System.Web.SessionState;
public class Handler : IHttpHandler , IReadOnlySessionState , IRequiresSessionState {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
}
public bool IsReusable {
get {
return false;
}
}
}
Import XML file to Sql Server using SSIS
Posted by Venkat |
Labels:
Sql Server,
SSIS
Good Morning to Everyone.
Today I am going to discuss about the SSIS (Sql server Integration Services) ie: how to Export the XML file to Sql Server with Column name and Data.
What is SSIS ?
- To solve complex busniess problems.
- sending and downloading files
- sending email messages in response to events
- Update Datawarehousing
- Cleaning and Data mining
- Managing Sql server data objects
Its the concept of ETL - ie. Extract - Transform - Load
Purpose:
1) Automate maintenance of sql server Database.
2) Update MultiDimensional Cube data as well.
I have the situation that xml file can be imported to the SQL server ie: i have the xml file look like this
I have convert this XML file to DB tables. It should be same schema , contraints, Relationship, trigger etc..
For this SSIS is a easy way to convert any XML , text , Word , Excel file to Sql Database.
So you have to choose Business Intelligence and Development Studio (BIDS) to do the task
There are three ways to create a packages.
1) SSIS Designer(BIDS - Business Inelligence Development Studio)
2) API Programming
Today I am going to discuss about the SSIS (Sql server Integration Services) ie: how to Export the XML file to Sql Server with Column name and Data.
What is SSIS ?
- To solve complex busniess problems.
- sending and downloading files
- sending email messages in response to events
- Update Datawarehousing
- Cleaning and Data mining
- Managing Sql server data objects
Its the concept of ETL - ie. Extract - Transform - Load
Purpose:
1) Automate maintenance of sql server Database.
2) Update MultiDimensional Cube data as well.
I have the situation that xml file can be imported to the SQL server ie: i have the xml file look like this
<dataset> <items> <empid>1</empid> <empname>ela</empname> <empcity>madhurai</empcity> <empsalary>10000</empsalary> </items> <items> <empid>2</empid> <empname>arun</empname> <empcity>chennai</empcity> <empsalary>20000</empsalary> </items> <items> <empid>3</empid> <empname>kumar</empname> <empcity>bangalore</empcity> <empsalary>25000</empsalary> </items> </dataset>
I have convert this XML file to DB tables. It should be same schema , contraints, Relationship, trigger etc..
For this SSIS is a easy way to convert any XML , text , Word , Excel file to Sql Database.
So you have to choose Business Intelligence and Development Studio (BIDS) to do the task
There are three ways to create a packages.
1) SSIS Designer(BIDS - Business Inelligence Development Studio)
2) API Programming
3) Import and Export Wizard
Here I am using the BIDS its a Graphical tool to create a packages, withoud need to write single line of code.
Open the new Project on Sql Server Integration Services.
Here is the steps to follow.
1. Create a new SSIS project in VS2005
2. Create a new data flow task - Double-click on the added task
3. Drag "xml source" from toolbox into data flow panel,Double Click on the XML
DataSource - a window opens select the xml file, and then generate XSD schema if not.
4. You could drag a "SQL Server detination" to the panel as data destination, connect XML source and SQL Server Destination, and use a new table.
Suppose if you getting Package Validation Error - Use the "data conversion" component in a data flow.
There may be the Datatype can be mismatched on Output columns. so at that time you can directly change the Datatype follow the below steps.
1. Right click the XML source->Show Advanced editor->Input and Output properties
2. Expand inputname->External Columns->Column name
3. On right panel, try to change the Datatype directly.
OR you could use "data conversion" component to convert the field that does not have the proper data type.
Finally if you check the DB it contains the New Table with the column Name and its all Data available in the xml file.
Ref:
Ref:
Validate Checkbox and Checkboxlist in easy way
Hi Good Evening Techies.
I saw the post that has been asked number of times ie: how to validate the Checkbox and checkboxlist
so we can validate the Both of this using the Javascript or JQuery , but here I am going to make it much more easy ie: 4guysformula Provides the Control which can added to our toolbox then you can work these similar to the other validation Control
Validation Control for Checkbox and Checkboxlist
Go to the page down - Get the control ie: dll file ie: skmvalidators.dall place the file on Bin Folder of your project then add the dll file to your toolbox. then drag and drop to your aspx page & set some property thats it.
Alternatively Download the file here skmValidators.rar
Alternatively Download the file here skmValidators.rar
AjaxHoverMenuExtender with ASP.NET
Today i am going to discuss, how to use AJAXHoverMenuExtender with ASP.NET. There are javascript available for onmouseover function which shows some text or something like menus. Today I am going to implement the same on serverside by using ajax functionality. There are number of tools available with ajax for our requirement I am going to use AjaxHoverMenuExtender - it show the menus or some text onmouseover of control or image or text.
First Create AjaxEnabled Website - so it automatically include AJAX Controls on your toolbox.
Place the ScriptManager on your page.
<ajax:ScriptManager ID="ScriptManager1" runat="server"> </ajax:ScriptManager>
Then Drag the Hyperlink and AjaxHoverMenuExtender on the Design page.
<asp:HyperLink ID="Hyperlink1" runat="server" Text="Session Mode" NavigateUrl="~/Description.aspx"></asp:HyperLink> <ajaxToolkit:HoverMenuExtender ID="hme2" runat="Server" TargetControlID="Hyperlink1" PopupControlID="Panel1" PopupPosition="Center" OffsetX="-25" OffsetY="15" />
Main Properties of AjaxHoverMenuExtender
TargetControlID - Specify the server ControlID where you going to show the popup text.
PopupControlId - Specify the ControlD which shows the popup while onmouseover of the
text of link.
PopupPosition - Center , Left , Right .
OffSetX , OffSetY - specify the X and Y position on that page according to the parent
Control.
Now i have to define the PopUp so this will be shown while mouseover.So here I used the panel which contains Datalist inside Where I bind the data from DB.
<asp:Panel ID="Panel1" runat="server" Width="600px"> <asp:DataList ID="Dtl_Unit" CellPadding="1" CellSpacing="1" ShowHeader="False" BorderWidth="0px" runat="server" DataKeyField="ServicesSubId" DataSourceID="Sqd_Unit" RepeatColumns="5"> <ItemTemplate> <table border="0"> <tr> <td> <asp:HyperLink ID="Hyperlink2" runat="server" NavigateUrl='<%#"Description.aspx?SId="+Eval("sessionmodeID") %>' Text='<%#Eval("sessionmodeName")%>'></asp:HyperLink> </td> </tr> </table> </ItemTemplate> <ItemStyle BorderWidth="0px" /> </asp:DataList> <asp:SqlDataSource ID="Sqd_Unit" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [sessionmodeID], [sessionmodeName] FROM [SessionTable]"> </asp:SqlDataSource> </asp:Panel>
Output:
Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page.
Posted by Venkat |
Labels:
Error and Solutions
When i faced this issue
Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page.
I fixed it by putting my Databind code ie: Gridview Databind code in the Page_Load event in a !Page.IsPostBack block
Solution:
if(!IsPostback) { //Bind the Gridview Databind }
CATEGORIES
- ASP.Net (78)
- C# (36)
- Validation (16)
- Regex (14)
- Error and Solutions (10)
- Javascript (7)
- Vb.Net (7)
- Email (6)
- Image (5)
- System.IO (5)
- Tiny_Mce Editor (4)
- DateTime (3)
- GDI (3)
- Refresh issue (2)
- Sql Server (2)
- captcha (2)
- AJAX (1)
- Date (1)
- Default button (1)
- Download a file (1)
- Eval (1)
- Google (1)
- Google Map (1)
- HTML Validation (1)
- Inline Tags (1)
- Like Operator (1)
- Logout (1)
- MCC Award (1)
- Paypal (1)
- Rich Text Editor (1)
- Round Corner (1)
- SSIS (1)
- StringBuilder (1)
- Tooltip (1)
- Viewstate MAC failed (1)
- Windows Forms (1)
- Windows Service (1)
- XML (1)
- file upload (1)
- masterpage (1)
Curabitur vel urna.
In tris tique orci portti tor ipsum.
Scing elit Augue scientieted musica.
Scing elit Augue scientieted musica.
Entertainment
Lorem Ipsum
- AJAX (1)
- ASP.Net (78)
- C# (36)
- captcha (2)
- Date (1)
- DateTime (3)
- Default button (1)
- Download a file (1)
- Email (6)
- Error and Solutions (10)
- Eval (1)
- file upload (1)
- GDI (3)
- Google (1)
- Google Map (1)
- HTML Validation (1)
- Image (5)
- Inline Tags (1)
- Javascript (7)
- Like Operator (1)
- Logout (1)
- masterpage (1)
- MCC Award (1)
- Paypal (1)
- Refresh issue (2)
- Regex (14)
- Rich Text Editor (1)
- Round Corner (1)
- Sql Server (2)
- SSIS (1)
- StringBuilder (1)
- System.IO (5)
- Tiny_Mce Editor (4)
- Tooltip (1)
- Validation (16)
- Vb.Net (7)
- Viewstate MAC failed (1)
- Windows Forms (1)
- Windows Service (1)
- XML (1)
Lorem Ipsum
- AJAX (1)
- ASP.Net (78)
- C# (36)
- captcha (2)
- Date (1)
- DateTime (3)
- Default button (1)
- Download a file (1)
- Email (6)
- Error and Solutions (10)
- Eval (1)
- file upload (1)
- GDI (3)
- Google (1)
- Google Map (1)
- HTML Validation (1)
- Image (5)
- Inline Tags (1)
- Javascript (7)
- Like Operator (1)
- Logout (1)
- masterpage (1)
- MCC Award (1)
- Paypal (1)
- Refresh issue (2)
- Regex (14)
- Rich Text Editor (1)
- Round Corner (1)
- Sql Server (2)
- SSIS (1)
- StringBuilder (1)
- System.IO (5)
- Tiny_Mce Editor (4)
- Tooltip (1)
- Validation (16)
- Vb.Net (7)
- Viewstate MAC failed (1)
- Windows Forms (1)
- Windows Service (1)
- XML (1)
Headline Animator
Site Worth
My site is worth$16,159.24Your website value?
Recent Post - Widget
FEEDJIT Live Traffic Feed
Subscribe via email
Pages
My IndiRank
Powered by Blogger.
Followers
About Me
- Venkat