|
What is up with all the deleted posts? Maybe "James Bond" can figure that out??
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi,
I am writing a code in c# with asp.net 2003 for export to excel from Repeater Control.In this I am facing file size is very big than normal.It has 5000 rows also 120 Columns.In these around 60 Columns are containing text class(style Sheet).I got exported file size is 32 MB.But if I copy those rows from exported file and paste it into new file , the new file has only 5.2 MB.Even If i open the exported file and save as new copy ,Its also contains 5.2 MB only. How to Reduce my file size while exporting only.My code is
<br />
string strFilePath="";<br />
DateTime tTime = DateTime.Now;<br />
strFilePath = "ADSL"+tTime + ".xls";<br />
strFilePath = strFilePath.Replace("/","");<br />
strFilePath = strFilePath.Replace(" ","");<br />
strFilePath = strFilePath.Replace(":","");<br />
string serverpath = Request.PhysicalApplicationPath.ToString();<br />
serverpath += @"ExcelFiles\";<br />
if (!Directory.Exists(serverpath))<br />
{<br />
Directory.CreateDirectory(serverpath);<br />
}<br />
serverpath += strFilePath;<br />
string style = @"<style> .text { mso-number-format:\@; } </style> ";<br />
Repeater1.Items[0].Visible = true;<br />
Response.Clear(); <br />
Response.AddHeader("content-disposition", "attachment;filename=" +serverpath);<br />
Response.ContentType = "application/vnd.ms-excel";<br />
System.IO.StringWriter stringWrite = new System.IO.StringWriter();<br />
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);<br />
Repeater1.RenderControl(htmlWrite);<br />
Response.Write(style);<br />
Response.Write(stringWrite.ToString());<br />
Response.End();<br />
If anyone knows answers, Plz reply fast.This is urgent
Regards
prabu
|
|
|
|
|
Hi there,
Can anyone suggest the best way, or point me in the direction of, escaping or qualifying an ' (apostrophe) character within a StringBuilder?
Unsurprisingly, I get a 'Missing operand after' error with the following:
sb = "LastName = 'O'Brien'"
Thanks
Jon
|
|
|
|
|
StringBuilder sb = new StringBuilder(@"LastName = 'O'Brien'");
Standards are great! Everybody should have one!
|
|
|
|
|
Thanks for this Bekjong,
Sorry - I forgot to say I am getting the error on this line:
namesBindingSource.Filter = sb.ToString();
Thanks
Jon
|
|
|
|
|
In SQL, you have to prefix single quotes with single quotes.
yourQuery = "SELECT * FROM Grades WHERE StudentName = 'Scarlett O ''Hara'"
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Following code gives me no error
BindingSource o = new BindingSource();<br />
StringBuilder s = new StringBuilder("LastName = 'O'Brien'", 50);<br />
o.Filter = s.ToString();
Am I missing something?
|
|
|
|
|
Thanks Vikram, d@nish,
Thanks for the tip Vikram.
d@anish - Yes you're right, however I get the error when applied to my namesBindingSource
Thanks
Jon
|
|
|
|
|
Hi all,
I need change text in external .rtf file using c# code..
thank you..
%#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG
|
|
|
|
|
Seems like you've been asking this for days. I suspect that putting it into a rich text box is the easiest way to change it and keep it in RTF format. Otherwise you need to get another RTF parser, or write one.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Good afternoon.
I have been tasked with "scraping" the URL from a firefox browser from our C# program. The issue I ran into is that the Address bar in Firefox is not accessible.
Can any body help me in this
Thank you for your time on this matter,
Mihir
|
|
|
|
|
hi all,
on my aspx page which is a child page of a master page.
i have a textbox say "TextBox1" with that i have one button say "Button1"
now on ClientClick on Button1 i want to open a popup which will have some list box say "LSt1" and a button say "OK"
as user selects some option from lst1 and clicks on Ok then those selected values should come in Textbox1 without any page refresh.
I am able to do this all but only the problem is my base page is postbacking itself.
A glimpse of code i m trying to use:
main aspx page>>>>
function OpenNewPopUpWindow(Url)
{
var Attributes='width=400,height=300,left=200,top=200,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=yes, resizable=no';
window.open(Url,"PoPup",Attributes);
}
asp:Button ID="btntxtFindingsComments" runat="server" CausesValidation="False" Text="..."/>
main aspx.cs page>>
btntxtFindingsComments.Attributes.Add("onClick", "javascript:OpenNewPopUpWindow('PoPup.aspx?Id=" + txtFindings.ClientID + "&CommentId=901');");
Popup.aspx>>
function LoadValues(clientCtrl, selectedValue)
{
window.opener.document.getElementById(clientCtrl).value = selectedValue;
self.close();
}
<asp:listbox id="lstTIPComments" runat="server" appenddatabounditems="false">
<asp:button id="Button1" runat="server" text="Close" onclick="Button1_Click">
popup.aspx.cs>>
protected void Button1_Click(object sender, EventArgs e)
{
string selectedValue = "";
for (int i = 0; i < lstTIPComments.Items.Count; i++)
{
if (lstTIPComments.Items[i].Selected == true)
{
selectedValue = " " + selectedValue + lstTIPComments.Items[i].Text + " ";
}
}
Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "LoadValues('" + Request.QueryString["Id"].ToString() + "','" + selectedValue + "');");
}
|
|
|
|
|
sanchit_mum07 wrote: on my aspx page
Guess you meant to post this in the ASP.NET forum ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I was a VB.Net guy, and now I became a C# programmer, and I have a little question. In VB.Net there is a possibility to select a control in the drop down list at the top of the screen, and then view all the possible events for this control at the other drop down list (on the other side of the screen). Is it possible in C# as well ? I can't figure out how to do it.
|
|
|
|
|
Events on C# located on the properties window for each control yellow icon on the top
|
|
|
|
|
ya, from thats ok, but how from source like in vb , from vb you can select controls and their related all events from aspx.vb page.
So same way, how can we do in c#.net
|
|
|
|
|
In C# you don't have the option to select the control and than select it's events... from the source file.
You have to refer to property page.
|
|
|
|
|
Look at the code that's generated in the designer file. You can hook up the events as delegates in code, if you like. However, you can't specify that a method handles an event in the place where you define the method, the way VB does it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i have the following code:
SqlCommand insertcommand = new SqlCommand();
insertcommand.Connection = con; //connection to SQLserver2000
insertcommand.CommandType = CommandType.StoredProcedure;
insertcommand.CommandText = "InsertQueryoperation";
SqlParameter AwardNum = new SqlParameter("@Award_num",SqlDbType.Int);
//@Award_num SQL Variable on InsertQueryoperation procedure
AwardNum.Direction = ParameterDirection.Output;
// parameter should sent the data to DataSource
txtAward.Text=AwardNum.Value.ToString();
insertcommand.Parameters.Add(AwardNum);
insertcommand.Connection.Open();
insertcommand.ExecuteNonQuery(); //NullReferenceException Accoured here
insertcommand.Connection.Close();
what is the problem with that code?
regards
|
|
|
|
|
The only problem that seems to be the one for me is that the parameter direction should be input not output
you can get more detail by looking at the exception stack trace.
|
|
|
|
|
Hi.. I am making a site using .net 2.0 with C#. On my site client may upload image or pdf document. So how to convert the pdf document to image format and display it as image? Its urgent...
|
|
|
|
|
needhi_p wrote: Its urgent
But not urgent enough to google? The first and third hits look promising here[^]
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
The code below is all in one class:
<br />
private string test = "nothing";<br />
<br />
public void deviceArrival(DeviceMonitorEvent dme)<br />
{<br />
this.test = "changed";<br />
}<br />
The event handler (method) is only run in the background thread, the instance variable is only used in my main thread.
When the event is fired, I want to change the value of 'test' in the main thread to "changed".
Currently it stays as "nothing" because I don't know how to cross-thread the two.
Any ideas?
Cheers,
modified on Wednesday, May 21, 2008 1:00 AM
|
|
|
|
|
Without seeing any of your code, just how are we supposed to help you?
You have to use a delegate to call a method that does the UI work, and when the event is triggered, you call this.Invoke() or one of its overloads. As to what the compiler is complaining about, I have no idea.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Vikram A Punathambekar wrote: Without seeing any of your code, just how are we supposed to help you?
The code below is all in one class:
<br />
<br />
private string test = "nothing";<br />
<br />
public void deviceArrival(DeviceMonitorEvent dme)<br />
{<br />
this.test = "changed";<br />
}<br />
<br />
The event handler (method) is only run in the background thread, the instance variable is only used in my main thread.
When the event is fired, I want to change the value of 'test' in the main thread to "changed".
Currently it stays as "nothing" because I don't know how to cross-thread the two.
Cheers,
|
|
|
|