|
try this code:
<b><u></u>Method 1:</b>
on page 1:
Session["Value"]=textBox1.text.tostring();
on page 2:
retrieve value by using
label1.text=Session["value"].tostring();
Method 2:
On page 1:
response.redirect("default2.aspx?value='"+textbox1.text+"'");
on page 2:
string str=request.queryString("value").tostring();
label1.text=str;
|
|
|
|
|
On application i am working there presents two gridview more like master-detail form. When user click on row in master grid, its details got displayed in second grid.
Now i want to export these to excel.
I can export both grid to different excel files, i.e one excel for master grid, and other for detail.
But i want to export them in single file.
Is there a way to achieve this?
need help.
|
|
|
|
|
Can I have code U r Using for Export to Excel? Rashmi.M.K
|
|
|
|
|
sure there is. Look at this article. It specifically for exporting datagridview(s) to excel.
As for two datagrids on the same file I wouldexport one to sheet1 and the second to sheet2 or
Mater and Details.
|
|
|
|
|
thanks for reply.
exporting to excel is not an issue.
also exporting them to separate files is ok.
But my problem is how to correlate them as i do in my application.
Hope you had seen master detail standard ex for notrhwind DB.
Now whenever user click on particular order, its corresponding details displayed in 2nd grid.
I also doing this, and exporting them also(but in 2 files). NO ISSUE.
But how to correlate them in excel file.
so that user can identify this detail belong to that order.
|
|
|
|
|
I would export them as I mentioned and then record a macro for some VLookUP or something
(I don't know what you want exactly). An then adapt the macro to C# code so that the exported
files/sheets are already linked.
[Edit]
Or simpler. I would create a template file that contains all the formulas(Excel or custom VBAs)
and export the datas in that template. Now when the user enters a text in cell F5 for example
the formulas will autocomplete the details for that text. Something like that. It's easier than
creating formulas from C#.
[/Edit]modified on Tuesday, March 2, 2010 8:35 AM
|
|
|
|
|
Hi All
I'm trying to author a control which displays text vertically. I've overridden the OnPaint method and Text property so that if the Text is Changed it calls the new OnPaint method. When the text is changed, the old text does not disappear and the new text is overlaid on the old. How do I stop this from happening?
The OnPaint method looks like this
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
if (!String.IsNullOrEmpty(Text))
{
System.Drawing.Graphics formGraphics = pe.Graphics;
System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 10);
System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
float x = 150f;
float y = 50f;
System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat(StringFormatFlags.DirectionVertical);
formGraphics.DrawString(Text, drawFont, drawBrush, x, y, drawFormat);
drawFont.Dispose();
drawBrush.Dispose();
formGraphics.Dispose();
}
}
And the Text property is
public override string Text
{
get { return base.Text; }
set
{
base.Text = value;
this.OnPaint(CreateNewPaintEventArgs());
}
}
private PaintEventArgs CreateNewPaintEventArgs()
{
return new PaintEventArgs(CreateGraphics(), new Rectangle(new Point(0, 0), Size));
}
Your help is appreciated.The FoZ
|
|
|
|
|
Don't call OnPaint! Never, ever, call OnPaint directly.
Use Invalidate instead - it causes the framework to correctly call OnPaint with the appropriate graphics object etc.You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Thanks OriginalGriff.
I changed my Text property to
public override string Text
{
get { return base.Text; }
set
{
base.Text = value;
this.Invalidate();
}
}
and all is well.The FoZ
|
|
|
|
|
Hey,
I have my data in a grid (no datagridview), export a grid (30 cols and over 20.000 rows) takes a lot of time (minimum 2minutes)...
now my question: Is there a way to accelerate this?
for (int i = 0; i < UsingGrid.Cols; i++)
{
for (int j = 0; j < UsingGrid.Rows; j++)
{
worksheet.Cells[j + 1, i + 1] = ConvertToExcelFormat(Convert.ToString(UsingGrid[j, i]));
}
}
Thank you
|
|
|
|
|
|
Why can't you use Response.write with Inline or attachment file type to export data from Grid to Excel. Rashmi.M.K
|
|
|
|
|
|
Hi
I have string say "Deepak"
how do i convert this into a byte array of 44,65,65,70,61,6b. I converted the ascii to
hex-string "44656570616b" using
String.Format("{0:x2}", (uint)System.Convert.ToUInt32(tmp.ToString()));
thanks
|
|
|
|
|
Turning a string into its ASCII bytes, if possible, is done using Encoding.ASCII.GetBytes(string)
BTW: The code you have shown converts a number to a string, which in .NET is always using Unicode, not ASCII.
|
|
|
|
|
it returns "68, 101, 101, 112, 97, 107.
i need to get 44,65,65,70,61,6b
|
|
|
|
|
GetBytes() returns bytes, which means numbers. You can turn those into strings again using whatever convention you choose. "Deepak" starts with a "D" which is 68 when counting in decimal, 44 in hex, 102 in octal, etc. If you want hex, you probably need to apply ToString("X2") to each of those bytes.
|
|
|
|
|
hi all,
I have made simple windows based application to illustrate the event fire when we click on the stop debugging button in VS 2008.
Actually, When i click on the "close" button of the form in the running application . It invokes the method as mentioned in the "form_load" event
e.g.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "Hello"
AddHandler System.Windows.Forms.Application.ApplicationExit, AddressOf abcMethod
End Sub
Private Sub abcMethod()
End Sub
but when i directly click on the "stop" debugging in the menu option in VS 2008,it doesn't go to the breakpoint inserted at the form_load event. I want to know which event fires at click of the stop debugging button in the menu option in vs 2008.
Thank you
|
|
|
|
|
AFAIK none. Stopping an app inside the debugger is like killing it in Task Manager, no more code gets executed.
|
|
|
|
|
thanx for ur answer.
u mean no event fires on stop the debugging ????
|
|
|
|
|
If you click 'Stop Debugging' the program will close, I think immediatly, with no events fired.
If you want to have the ApplicationExit event fire, you need to close your application with the 'X' button or by some method that calls Application.Exit() .
|
|
|
|
|
Hi,
I have a webservice that send bulk SMS and it works for English language. The problem is when users send SMS using ARABIC text no SMS is receieved.
Please help me to improve or change my code so it will work for arabic characters. I think the problem is when converting the string to UTF-8 code.
MY Webservice:
http:
MY C# Code that send the message to my webservice.
string sMessage = وقت البلاغ:" ;
byte[] utfCodes = System.Text.Encoding.UTF8.GetBytes(sMessage);
//second solution
SendGSM.send_sms(utfCodes); Dabsukol
|
|
|
|
|
try this:
byte[] utfCodes = System.Text.Encoding.Default.GetBytes(sMessage);
|
|
|
|
|
byte[] utfCodes = System.Text.Encoding.Default.GetBytes(sMessage);
byte[] utfCodes = System.Text.Encoding.UTF8.GetBytes(sMessage);Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Why don't you just pass the string to web-service rather than passing byte array? Best wishes,
Navaneeth
|
|
|
|