Create Print Template - c#

I have a web services application where I would like the users to be able to define print page templates with database field placeholder in my project.for this reason I
have to provide environment for design template for my users.this templates must save in database,
then for print I get data from database and put it in placeholders.I found that "XSLT" can be usefully for this issue, but a big problem is Html result for XSLT.If There is any solution please let me know.
thanks in advance

what you can do is: create a html file template, create field placeholder in it. When you need to print it, load data from database, replace the placeholder, create the html file, load it into webbrowser class (it does not have to have an UI). then print from there.
since it is html file, you can save it to database too.
it works great in one of our project which has the same requirement.

Related

C# Is it possible to change HTML from the web browser?

I´m wondering if it could be possible to change the HTML document text directly from the web Browser.
I´m currently working on an email client, which uses a html template for the design.
Everything seems good but I need to configure the template.
Like I said, the template is stored in a rich textbox, which is invisible.
Basically I can see the web Browser with its template, only.
Now I want to insert my custom text to the template.
Is it possible to change the htmldocumenttext directly from the webbrowser ?
Is there another way to edit the content of the template ?
You bet it's possible. Whole libraries are written around modifying the HTML after initial delivery to the browser. Start here: http://www.w3schools.com/js/js_htmldom.asp. Then maybe: https://jquery.com/

How can I copy HTML textbox values from one domain to another domain's textboxes?

I'm trying to help save time at work with for a lot of tedious copy/paste tasks we have.
So, we have a propitiatory CRM (with proper HTML ID's, etc for accessing elements) and I'd like to copy those vales from the CRM to textboxes on other web pages (outside of the CRM, so sites like Twitter, Facebook, Google, etc)
I'm aware browsers limit this for security and I'm open to anything, it can be a C#/C++ application, Adobe AIR, etc. We only use Firefox at work so even an extension would work. (We do have GreaseMonkey installed so if that's usable too, sweet).
So, any ideas on how to copy values from one web page to another? Ideally, I'm looking to click a button and have it auto-populate fields. If that button has to launch the web pages that need to be copied over to, that's fine.
Example: Copy customers Username from our CRM, paste it in Facebook's Username field when creating a new account.
UPDATE: To answer a user below, the HTML elements on each domain have specific HTML ID's. The data won't need to be manipulated or cleaned up, just a simple copy from ourCRM.com to facebook.com / twitter.com
Ruby Mechanize is a good bet for scraping the data. Then you can store it and post it however you please.
First, I'd suggest that you more clearly define exactly what it is you're looking to do. I read this as you're trying to take some unstructured data from Point A and copy it to Point B. Do the names of these fields remain constant every time you do the operation? Do you need to simply pull any textbox elements from the page and copy them all over? Do some sort of filtering of this data before writing it over?
Once you've got a clear idea of the requirements, if you go the C# route, I'd use something like SimpleBrowser. Judging by the example on their Github page, you could give it the URL of the page you're looking to copy, then name each of the fields you're looking to obtain the value of, perhaps store these in an IDictionary, then open a new URL and copy those values back into the page (and submit the form).
Alternatively, if you don't know the names of the fields, perhaps there's a provided function in that or a similar project that will allow you to simply enumerate all the text fields on the page and retrieve the values for all of them. Then you'd simply apply some logic of your own to filter those options down to whatever is on the destination form.
SO we thought of an easier way to do this (in case anyone else runs into this issue).
1) From our CRM, we added a "Sign up for Facebook" button
2) The button opens a new window with GET variables in the URL
3) Use a greasemonkey script to read those GET variables and fill in textbox values
4) SUCCESS!
Simple, took about 10 minutes to get working. Thanks for you suggestions.

Creating prepopulated aspx files with c#

My objective is to write a program that can create folders and within those folders create Default.aspx pages. The Default.aspx pages must read information from the database to populate the page using their containing folder name as a parameter to call the database.
Create the folders is the easy part, but I'm not sure how to go about writing information to .aspx files.
The goal of this project is so a real estate company can create pages for featured properties (through a cms), each featured property getting it's own folder/page.
Any feedback would be great.
-Aaron
Rather than physically creating the .aspx files, I think it makes more sense to have 1 .aspx file, which is passed querystring values to return different content from the CMS, depending on its value.
Furthermore, you could use URL Rewriting to make the file appear as if its in a physical location, within a folder.
For example:
/Property.aspx?agent=EstateAgent1&name=Property1
Can be rewritten to:
/EstateAgent/Property1.aspx
If you have to generate folders and files, I'd recommend simply generating HTML files, as theres no need for the file to be dynamic, or ran at the server
I would create a template ASPX page, and copy that template into the new folders. Within the template, define the layout and add all of the necessary controls for displaying the data. Doing it this way, you can change your template as needed for changes, and after the template is copied to the folder you can customize it as needed.
I would be remiss not to warn you that this approach will be very difficult to maintain though. Unless there is some requirement I'm unaware of, I don't know why this approach would be favorable.
Hope this helps.

C# Winforms WebBrowser edit html

I want to display a webpage in a WebBroswer in my winforms application. I however want to use some custom css to change how the page looks. Is it possible to attach a style sheet and edit the html page you are viewing?
You can use this web control http://www.codeproject.com/KB/miscctrl/csEXWB.aspx
and save it as a web page and load and you can show the source in another text box , once changes are made you can save to a temp file and load it. There is an option to view local file.
I don't think that kind of thing is supported.. but anyway that would be a horrible thing to do. you may end-up interfering with the CSS used by the client page.
Have you ever seen your browser override your CSS used by page and say i want to show it this way. (I know development tools like firebug,etc do it)

Home/Landing screen design for a website in asp.net

I have an web based application. The content for the Home page has been currently mentioned in the HTML code for the Home page using , and tags. To change the content anytime in future, it needs to be changed in the HTML code. :(
Is there a way that we can pick up the content from some external place and get it reflected through the website. This ways, any change if required can be made at the external location without referring to the application's code.
Please advise if there is any solution for it.
Thanks.
You can
Use a database
Include external files using Server Side Includes
Read external files and write their contents and an alternative method
Sounds like you're looking for a Content Management System (CMS), which will allow your content editors access to modify only specific blocks of a page that you specify.
There are a ton out there to do what you want, so you don't have to start from scratch. Just Google 'CMS'.
Although I haven't used it myself, DotNetNuke is a popular one these days and has a free version.

Categories

Resources