|
Well, the javascript window.print() should print out whatever the browser has rendered. I'm guessing your "Print" button is first posting back to the server?
|
|
|
|
|
For my webpage, I am using the VS IDE to design the page and putting the C# code in the codebehind.
When I click on the html tab in the designer to put in OnClientClick="window.print(); return false;" for my print button, the designer draws a red line underneath OnClientClick and the print button doesn't work. When I added this code in the codebehind,
private void PrintBtn_Click(object sender, System.EventArgs e)
{
string strJScript2 = "window.print();";
Page.RegisterStartupScript("Alert", strJScript2);
}
then the print button works correctly when I am viewing the page from the server. When I am viewing the page from a client PC it would print whatever is on the page before I press the "Generate Report" button.
|
|
|
|
|
Are you using ASP.NET 2.0?
|
|
|
|
|
No, I am using VS .Net 2003 with 1.1 framework.
|
|
|
|
|
That's why OnClientClick didn't work - that's a 2.0 attribute.
Okay, then - try using a straight html/client way of hanlding this:
<input type="button" onclick="window.print();"
value="Print"
/>
|
|
|
|
|
Thanks alot for your help Mike, I got it working correctly.
|
|
|
|
|
I have a slight problem with the window.print() function. When there are more data than what my DataGrid can display within its define height, a vertical scrollbar appears. When the user clicks the print button, it only prints out what is currently display on the screen. Is there a way for me to get it to print all the data that is on the DataGrid instead of having the user scroll down on the DataGrid to print out the rest of the data? I have noticed that certain websites have a "Printer Friendly Version" button that when clicked will format all the information on the page so that all the contents can be printed. Is there a way to do this in C#, thanks.
|
|
|
|
|
Hello,
We have a windows 2003 server and we were able to publish our websites
(developed on XP prof) before. Now, we have made some changes to our
site and want to republish to the same folder and it doesn't publish
now. At the end it also asks
"Existing files in the destination location will be deleted continue?"
I said yes but when I look at webfolder on the server (2003 server) I
see all the old files but not the new ones.
Am I missing some thing here? We haven't made any changes to our
windows 2003 server or on our development machines either. I also tried
publishing our site to a new web folder under the same website but it
doesn't work either.
But I can publish it to my local inetput/wwwroot folder. But can't on
the remote server where we used to publish before.
I think may be its because of the permissions but not sure how to
configure them.
Please help,
Thanks
-L
|
|
|
|
|
is it possible to bind data from two diff.database's tables in a single datagrid?how?
|
|
|
|
|
If the two tables are relatable they can be JOINed in a SQL statement. This would result in a single DataTable with the data from the two database tables, which could then be bound to a datagrid. For example, the following SQL statement selects all the distinct customers who have placed orders (pulling CustomerID from the Orders table, and joining in the associated CustomerName from the Customers table):
Select Distinct
o.CustomerID
, c.CustomerName
From Orders o INNER JOIN Customers c ON o.CustomerID = c.CustomerID Is this what you were talking about?
|
|
|
|
|
Create one datatable in your code behind file. (The DataTable is an in-memory representation of a block of data).Get the data from the database in two different datasets. Then fill the created data table with data from the different datasets available from different tables. (You have to programatically fill each column in the datatable). After filling the manually created datatable, bind the datagrid with this table.
From the above solution, you are binding the data grid to the manually created datatable in your code. The datasource can be anything. But be cautious this can reduce the performance of the application.
Hope this will help you
Thanks
Rakheesh
|
|
|
|
|
I have to validate the textbox 's text compare with dropdownlistbox items.
|
|
|
|
|
|
Just wonderin if anyone knew of any good sample's of character counting upon a webform so that users know how many characters they have left.
Any help is much appreciated.
|
|
|
|
|
|
Yeah the last example was similar to wat I was on about. instead of counting up Iwas wanting to count down and apply it to a label instead of a textbox. Got it sorted. Cheers King
|
|
|
|
|
I have a listbox with SelectionMode=Multiple in my script (VB) I can't seem to access all the selected values only the first one.
I've tried: (Search is my ListBox's ID and i is a number (I tryed 0, 1, and 2)
Search.SelectedValue (I get the first selected value)
Search.SelectedValue(i) (I get the character at position i)
Search.SelectedItem().Value (I get the first selected value)
Search.SelectedItem(i).Value (I get an error: 'Class 'System.Web.UI.WebControls.ListItem' cannot be indexed because it has no default property.')
Search.SelectedIndex().ToString (I get the first selected index)
Search.SelectedIndex(i).ToString (I get an error: 'Public Overridable Property SelectedIndex() As Integer' has no parameters and its return type cannot be indexed.)
I saw someplace that said to use Search.SelectedItems.Count and then loop using Search.SelectedItems(i).Value, but SelectedItems is not a member of 'System.Web.UI.WebControls.ListBox'.
Anyone know what I'm missing?
|
|
|
|
|
dim value as string
for each anItem as ListItem in Search.Items
if anItem.Selected then
value = anItem.value
'Do something with the data here
end if
loop
I think that's the Vb.net syntax...
|
|
|
|
|
anybody to help me to get the basics start in asp.net.. all i need is some codes with simple syntaxes to as i can get to know about this.. or where can i get some notes or book on asp.net
thank u all very much.......
ZuKzEx RuLz.....
|
|
|
|
|
|
hi all
is it possible to localize the telephone no
that is for india 91 -xxxxxxxxxxx
for some others (000)000-99999
coolsweety
|
|
|
|
|
hi
I am using a query like
select * from cars where car_make in('BMW','Mercedes','Accura') But it gives an error if I use Single Qoute in any car_make for example...
select * from cars where car_make in('BMW','Mercedes','Accura','infin'it')
I am using MySQL with vb.net.
THanks in advance
Lets work it Out.........!
|
|
|
|
|
If you were using SQL Server, you would have to write :
select * from cars where car_make in('BMW','Mercedes','Accura','infin''it')
For MySQL I am not sure, but try it this way.. I hope it'll work.
|
|
|
|
|
In fact these are two single quotes (not a double quote).
|
|
|
|
|
Use parameterised queries, or replace the quote with two quotes.
|
|
|
|