|
I've already read this article,but it doesn't help.
Any other suggestion?Thanx anyway!
|
|
|
|
|
This is my code:
void Button1Clicked(Object sender,System.EventArgs e)
{
Button a = (Button)FindControl("Button1");
a.Attributes.Add("OnClick","return confirm('Do you want to save?');");
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.ClearControls(GridView);
GridView.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
}
but it can't prompt out the alert page for you to save. How come?
Another problem,how to direct the page to a seperated excel page?
Can anyone pls correct it?Thanx so much!
|
|
|
|
|
|
is it possible to increment/decrement or such the datacolumn through the expression property?
|
|
|
|
|
hi,
Yes, It is possible to give features like auto numering in datacolumn.
Check the AutoIncrement property of datacolumn,expression etc.
Then use little bit logic
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
how can i do something like multiply all the values of a column by a constant through the expression property ?(not looping through the rows).
|
|
|
|
|
hi,
You can check DataColumn.Expression property for more information.
this is a small eg.
static void Main(string[] args)
{
DataTable Dtbl=new DataTable("MyTable");
Dtbl.Columns.Add(new DataColumn("Qty",typeof(Int32)));
Dtbl.Columns.Add(new DataColumn("Rate",typeof(Int32)));
Dtbl.Columns.Add(new DataColumn("Total",typeof(Int32),"Qty*Rate"));
for(int i=1;i<10;i++)
{
DataRow Dtr=Dtbl.NewRow();
Dtr["Qty"]=i*2;
Dtr["Rate"]=i+2;
Dtbl.Rows.Add(Dtr);
}
foreach(DataRow Dr in Dtbl.Rows)
{
Console.WriteLine(Dr["Total"].ToString()+"\n");
}
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
How can i write a program by C# which when i click a button in my program, Internet Explorer automatic choose a specify hyperlink in specify webpage. Do you have some sample to program with Internet Explorer 6?
Nothing
|
|
|
|
|
hi,
If you want to start external process in your C# application then you can go ahead with this
System.Diagnostics.Process.Start("www.codeproject.com");
this will open our site in your IE
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I have a dataset with two tables:
BookEntry <->> BookLines
I set "BookEntry" as Table for the dataview.
If I set the RowFilter property of the dataview, can I say:
BookEntryBookLines.Id = '0'
"Every rule in a world of bits and bytes can be bend or eventually be broken"
|
|
|
|
|
hi,
static void Main(string[] args)
{
DataSet Dset=new DataSet();
DataTable Dtbl=new DataTable("MyTable");
Dtbl.Columns.Add(new DataColumn("Qty",typeof(Int32)));
Dtbl.Columns.Add(new DataColumn("Rate",typeof(Int32)));
Dtbl.Columns.Add(new DataColumn("Total",typeof(Int32),"Qty*Rate"));
for(int i=1;i<10;i++)
{
DataRow Dtr=Dtbl.NewRow();
Dtr["Qty"]=i*2;
Dtr["Rate"]=i+2;
Dtbl.Rows.Add(Dtr);
}
foreach(DataRow Dr in Dtbl.Rows)
{
Console.WriteLine(Dr["Total"].ToString()+"\n");
}
Dset.Tables.Add(Dtbl);
DataView dv=new DataView();
dv.Table = Dset.Tables["MyTable"];
dv.AllowDelete = true;
dv.AllowEdit = true;
dv.AllowNew = true;
dv.RowFilter = "Qty = '16'";
dv.RowStateFilter = DataViewRowState.ModifiedCurrent;
}
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hi All,
I have a page with its height is 4 inch.
I need to print 7 lines of text per page.
Therefore, I must ensure that I can set the heigth
of text to 0.5 inch exactly.
Pease help me.
Thank you,
|
|
|
|
|
You can use Font constructor override to specify you want inches as units.
Font font = new Font("Arial", 7.0f, GraphicsUnit.Inch)
|
|
|
|
|
You wanted .5 inches height so it should be:
Font font = new Font("Arial", 0.5f, GraphicsUnit.Inch);
|
|
|
|
|
Thanks Werdna,
Please see comment in this suorce code.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Windows.Forms;
namespace TestPrint
{
public class PrintingExample
{
private Font printFont;
public PrintingExample()
{
Printing();
}
public void Printing()
{
try
{
PrintDocument pd = new PrintDocument();
printFont = new Font("Arial", 0.78f,System.Drawing.GraphicsUnit.Inch);
pd.DefaultPageSettings.PaperSize= new PaperSize("MP", 826, 468);
pd.DefaultPageSettings.Margins = new Margins (78,78,78,78);
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
pd.Print();
}
finally
{
}
}
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
float linesPerPage = 0;
float yPos = 0;
int count = 0;
float leftMargin = ev.MarginBounds.Left;
float topMargin = ev.MarginBounds.Top;
float fontHeight = printFont.GetHeight(ev.Graphics);
linesPerPage = ev.MarginBounds.Height / fontHeight;
System.Console.Out.Write("MarginBounds.Height: " + ev.MarginBounds.Height.ToString() + "\n");
System.Console.Out.Write("Font Height : " + fontHeight.ToString() + "\n");
System.Console.Out.Write("Line(s) per Page : " + linesPerPage.ToString() + "\n\n");
while (count < linesPerPage && count < 4)
{
string s = count.ToString() + ":" + fontHeight.ToString() + "/" + ev.MarginBounds.Height.ToString();
yPos = topMargin + (count * fontHeight);
ev.Graphics.DrawString (s, printFont, Brushes.Black, leftMargin, yPos, new StringFormat());
ev.Graphics.DrawLine(new Pen(System.Drawing.Color.Black),leftMargin,yPos,leftMargin+400,yPos);
count++;
}
yPos = topMargin + (count * printFont.GetHeight(ev.Graphics));
ev.Graphics.DrawLine(new Pen(System.Drawing.Color.Black),leftMargin,yPos,leftMargin+400,yPos);
}
public static void Main(string[] args)
{
new PrintingExample();
}
}
}
Nghĩa - I2A4U Group
|
|
|
|
|
I want to create a tabcontrol that has his rows spread over the entire width of the control. I know there is a property SizeMode - FillToRight, but that seems to work only with multilines.
CAn anyone tell me how to create this tabcontrol?
|
|
|
|
|
Total guess - but would width="100%" work?
|
|
|
|
|
|
I have had lots of trouble setting up the code on the computer I work. The project is a web service. When I load it, I share the wwwroot directory, get that sorted. When i try to open the solution, I keep getting the message, "Cannot get folder information from the server".
what does that mean?
Thanks
|
|
|
|
|
hi,
Check Whether Your Created Virtual Directory For Your Application
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
did you have some settings for the application in iis?
|
|
|
|
|
I have had problems with the Microsoft Installer. I want the setup to run 2 msi files. I cant seem to get around doing it as I get lost. I can configure the registry, conditions and requirements and the destination folder. Added the first of the 2 msi. Now, how do I add the next one.
Please help.
|
|
|
|
|
hi,
Microsoft installer tool is not much efficient for our all requirement. Once i faced the same problem. Better you can go for third party installers. For more informations you can view the post of this below mentioned threads.
Click Me
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I was wondering in a RichTextBox or whatever how you would go about having a dreamweaver/Visual Studio style tabbing i.e.
namespace
{
whatever
whatever
class
{
whatever2
whatever2
}
}
So when you enter a new line it keeps the tab at the same place unless you tab back? (and the tab is at a nice spaced distance).
Anyhow if you can make any sense of that and can help I would be great full.
Thanks,
Richard
|
|
|
|
|
I posted a snippet about 3-4 months back that does just that. I couldnt figure out how to set the tab sizes in the RTB though. Its a pretty useless control for coding...
top secret xacc-ide 0.0.1
|
|
|
|