|
This is the sample to create differenct sheets in same excel sheet
try this
Microsoft.Office.Interop.Excel.Application _excel;
Microsoft.Office.Interop.Excel._Workbook _wrkBk;
Microsoft.Office.Interop.Excel._Worksheet _excelSheet;
Microsoft.Office.Interop.Excel.Range _oRng;
//create an object og Excel Application.
_excel = new Microsoft.Office.Interop.Excel.Application();
_excel.Visible = false;
//Get a new workbook.
_wrkBk = (Microsoft.Office.Interop.Excel._Workbook)(_excel.Workbooks.Add(Missing.Value));
_excelSheet = (Microsoft.Office.Interop.Excel._Worksheet)_wrkBk.ActiveSheet;
Microsoft.Office.Interop.Excel._Worksheet _tempSheet = (Microsoft.Office.Interop.Excel.Worksheet)_wrkBk.Worksheets["Sheet1"];
int _defaultSheetCount = _wrkBk.Worksheets.Count;
for (int j = 0; j < dt.Rows.Count; j++)
{
if ((j + 1) <= _defaultSheetCount)
{
_excelSheet = (Microsoft.Office.Interop.Excel.Worksheet)_wrkBk.Worksheets["Sheet" + (j + 1)];
}
else
{
_excelSheet = (Microsoft.Office.Interop.Excel._Worksheet)_wrkBk.Sheets.Add(Type.Missing, _tempSheet, Type.Missing, Type.Missing);
}
_tempSheet = _excelSheet;
//write the data in the predefined format to the Excel Sheet.
_excelSheet.Cells[1, 3] = "test";
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
Hi,
how to divide each row of table in 48 cells Dynamically ?
Give me hint or example related to use of table.
thanks in advance
Rameez
|
|
|
|
|
rameez Raja wrote: how to divide each row of table in 48 cells Dynamically ?
Give me hint or example related to use of table.
Example
Table tbl=new Table();
TableRow tr=new TableRow();
TableCell tc;
for(int i=0;i<48;i++)
{
tc=new TableCell();
tc.Text=i.ToString() + "Number Of Cell";
tr.Cells.Add(tc);
}
tbl.Rows.Add(tr);
Take one PlaceHolder on the Page and Add this table
PlaceHolder1.Controls.Add(tbl);
Regard
Khan
please don't forget to vote on the post that helped you.
|
|
|
|
|
Yesterday I installed .NET Blog Engine on my ISP web server.
It works pretty well and now I have 2 blog.
The only problem I noticed, if I don't connect to the web site for a couple of hours and try to access the web site again, there is a waiting period of about 10 seconds when I try to access it for the first time (in the new timeframe).
Is there anyway to speed up this startup time?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Super Lloyd wrote: if I don't connect to the web site for a couple of hours and try to access the web site again, there is a waiting period of about 10 seconds when I try to access it for the first time (in the new timeframe).
Blog engine will be doing caching and might have set very less cache timeouts. When you request after some hours, it might be reloading data to the cache.
Small delay in page load may happen when you request after an application restarts. So make sure application is not recycling frequently.
|
|
|
|
|
What do you mean by recyclicng frequently?
Well it's all good and fast, it is only after a few hours without use that I have this performance hit, it looks more like a dismissed cache after a while, as well as a recompilation of the app as well perhaps...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Super Lloyd wrote: a recompilation of the app as well perhaps...
I meant this.
AFAIK, when application recompiles, it leaves an entry in the event viewer. Check that if it is happening frequently.
|
|
|
|
|
I'm a total beginner, and I'm building a web app with VB.
I have a database in SQL 2005 and my application is trying to find a business.
The user enters a string in the textbox and with that string build a query to get the desired results.
For phone numbers it should be easier, with the exact phone number find the exact match and display.
But for business name it's a little more complicated.
How do I go about in doing that? Any help is appreciated.
|
|
|
|
|
I have created a SQLDataSource that connects to the database and retrieves the correct information I need.
But I want to be able to invoke the results in a ListView only when the user clicks the button.
Any help appreciated. Total beginner!
modified on Thursday, July 24, 2008 11:41 AM
|
|
|
|
|
I'm creating a search page that displays record summaries from multiple tables and has a link to the full records in the page for the table they're from. As a result I can't define the DataNavigateUrlFields and DataNavigateUrlFormatString fields at design time.
Is there a way to edit them from the .cs file that I'm not finding, or do I need to do something else to create the hyperlink column?
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
this is rashmi, asp.net developer ..
we are developing website name: www.discareuropa.com this has to develop in 2 language English & Español
we have converted english to Español..through google translator and html pages are working fine..
Problem:-
if we use server side control..then we are getting problem
1st Translator language from English to Español, you will notice every thing change to Español....then put user name: admin password: admin (left side)
and page will redirected to lighterBrand.aspx ..and page is auto refreshing and converting into Espanol, (as we want) ..but auto refreshing it is not stoping, ..so kindly help me how can i stop this...
thanks/rashmi
|
|
|
|
|
Think about the following scenario...
While loading the page 'LighterBrand.aspx' you are calling the function
convertnew('en|es');
Using following code <script language='javascript'>convertnew('en|es');</script>
And in the function 'convertnew'
49th line in the JS function
indexof_p = pattern.indexOf('|');
So value of 'indexof_p' will be greater than 0.
So if (indexof_p == -1) will return a false and the control go to else part.
<br />
else {<br />
var psplit = pattern.split('|');<br />
new_pattern = psplit[0]+'|'+psplit[1];<br />
if (psplit[1] == 'en') {<br />
isen = 1;<br />
}<br />
<br />
Here if (psplit[1] == 'en') is false because our pattern is 'en|es'
So that the variable 'isen' remains blank.
And in the following if condition
<br />
if (isen == 1) {<br />
thisurl = new_location;<br />
}<br />
else {<br />
thisurl = 'http://translate.google.com/translate_c?langpair=' + new_pattern + "&u=" + new_location;<br />
}<br />
<br />
if (isen == 1) is false because 'isen' not set to 1.
So else part will work.
thisurl = 'http://translate.google.com/translate_c?langpair=' + new_pattern + "&u=" + new_location;
Then 'open_in_same_window' is 0. So that
So control goes to following 'if'
<br />
if (CanAnimate ){<br />
msgWindow=window.open('' ,'_self','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');<br />
msgWindow.focus();<br />
msgWindow.location.href = thisurl;<br />
}<br />
else {<br />
msgWindow=window.open(thisurl,'_self','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');<br />
}<br />
<br />
Here In both case
msgWindow.location.href = thisurl;
OR
msgWindow=window.open(thisurl,'_self','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
causes to open the page 'LighterBrand.aspx'
This causes to a call to the function 'convertnew('en|es');'
So that again the procedure that I explained will happen, Like a recursion
Hope this will help you.
|
|
|
|
|
During post back user1 gets user2 page. I am using cookiless form authentication in asp.net 2.0. How to prevent this problem ?
Thanks
|
|
|
|
|
Hello all!
I'm experiencing difficuties with the Date in ASP.NET. My project is written in C# and uses SQL queries. The problem is when the SQL query returns the date from the database it is different format from the one used in ASP.NET. Then the ASP generates mistake and I can't execute properly my program...The strangest thing is that happens only on my computer, so I guess it has something to do with some setting of the SQL server, but I can't find anything Please help me with this! Be free to ask any questions, because I'm sure I haven't explain properly the situation and I don't know what more info should I give you!
Thank you in advance!!!
|
|
|
|
|
|
Thank you for your quick answer, but I'm affraid that didn't help me We have multiple connections throw the project, but the method is connection dependent, a.k.a every time it connects it loses it's setting and that don't work for me. I need it to be permanent. And the command "set dateformat dmy" didn't work - the query return the wrong date...I don't know if I'm doing something wrong or this is just irreparable and there is something to do with the regional setting on my computer or something else...Because non of my co-workers have changed some setting at theirs SQL and they don't have my problem.
Please help!
|
|
|
|
|
Hi friends,
Iam trying to create a NUnitAddin for TestCase Builder after adding the required references in process i got the following error
Builder.Class1.SqlServerDatasourceAddIn' does not implement interface member 'NUnit.Core.Extensibility.ITestCaseBuilder.CanBuildFrom(System.Reflection.MethodInfo)'
Builder-is a placeholder for the name of your namespace
Class1-is a placeholder for the class name
|
|
|
|
|
Hi,
I am developing a website in which users register with their data. Immediately after registering a Unique number is generated.
So there is a chance of 3 or more users registering at the same time.
At that time concurrency problem will occur........How to avoid?
I am using SqlExpress as database and I wrote the code in Register Button click.....
Please help me....
Thanking you
McMilan.
|
|
|
|
|
Get the unique number in the global.asax session start
save it in session and use it when needed.
I didn't get any requirements for the signature
|
|
|
|
|
i am using Visual Studio 2005.Please could anyone help me out hoe to custom Validate date format in a Textbox..
pl explian in detail as m new to the domain..i have only limited knowledge of Javascript...
thanx
|
|
|
|
|
If your requirement is only to validate a date, u can use a compare validator.
<asp:CompareValidator id="dateValidator" runat="server" Type="Date" Operator="DataTypeCheck" ControlToValidate="MyTextbox" ErrorMessage="Please enter a valid date."></asp:CompareValidator>
OR
If you are specifically focusing on custom validation
date validation in javascript[^] help you
|
|
|
|
|
i want to edit the gridview,after clicking edit update the my data .
i wrote this code .its giving error Unable to cast object of type 'System.Web.UI.WebControls.DataControlLinkButton' to type 'System.Web.UI.WebControls.TextBox'.
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string Journal_Notes_ID = ((TextBox)GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).Text;
string User_ID = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
string Course_Instance_Item_ID = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
string Notes = ((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
string update = "UPDATE dbo.Journal_Notes_Meter SET Journal_Notes_ID = '" + Journal_Notes_ID +
"',User_ID = '" + User_ID +
"', Course_Instance_Item_ID = '" + Course_Instance_Item_ID +
"', Notes = '" + Notes +
"' WHERE itemid = '" + User_ID +
"';";
SqlCommand cmd = new SqlCommand();
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
GridView1.DataBind();
}
|
|
|
|
|
Hi,
You must have have filled the grid with DataSet. This is Connectionless Object. Mean we have fatched the result from Database and store it into a dataset, it remains their when Database Connection is closed.
Then You Update the database, but without fetching result and setting dataset again, you Bind the grid with previous dataset only which have copy of the resultset u have fatched before updating. Got it??
Mean your data is updated in table but you are not facting it again. Run select query again after updating and your problem will be solved.
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
plz guide me in code level
|
|
|
|
|
kathyani wrote: string Course_Instance_Item_ID = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
look at the line of code above...
You are casting the contents of this cell to a textbox. If the gridView is rendering this cell as a link, then this is the cause of the error.
Look at your grid, work out which one of those values is displayed as a link, thats your offending line of code, probably needs the cell index changing.
---Guy H ---
|
|
|
|