|
Actually, that's the way it was designed...for a very simple reason...if every time you wanted to do an insert, the db had to scan a table and find gaps in IDs, that process could take some time....(think 1M+ records in a table)
It does beg the question, why do you really care what Id is assigned, as long as one is? You're not going to be showing it to the user (ARE YOU!!!!) so really it doesn't matter!
The only reason I could think for wanting to do this is for touchy clients who insist on indexes starting at zero....that can be achieved as other posters have pointed out
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
hello all,
Can any one please help me. I want an asp.net application which on button click checks for existing msn or aol messenger application on my pc and runs it, if not found displays message you have not installed msn messenger on your computer.Any help will be appreciated.
thanks.
|
|
|
|
|
Hi there!
Can you people help me in using an Xml file as a Database...
Thank you.
|
|
|
|
|
You can't run SQL on it, unless you can import it into a dataset. You'd use XPath to search it instead.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi i have two dates in my table,
03-23-2007 8:00:00
03-24-2007 8:00:00
I have two dropdown in my page use to filter between those two dates.
i used to convert the two dates into CHAR
CONVERT(CHAR(10),date,110) so the result is just "03/23/2007" and "03/24/2007" but the problem now is, when i filter the date like
SELECT * FROM table WHERE date BETWEEN '03/23/2007' and '03/23/2007'
returns no value but if my query is like :
SELECT * FROM table WHERE date BETWEEN '03/23/2007' and '03/24/2007'
it returs value but only the rows with the date '03/23/2007'.
Any idea about that?
Bernie
|
|
|
|
|
I am tasked with creating a Spanish version of a working English web site. Is there a proper way to do this?
I'm thinking for ease I could duplicate the folder and change the text, but that doesn't seem like an easily scabale solution (when they come back and want two more languages added (or for sites > 10 pages)).
--G
|
|
|
|
|
The way our company works is that we create a string name for every string in the resource files. For example a string for Name on one page will be unique if it's in webpage1 as it's name will be webpage1.Name, which will then be different from a similiar string on webpage2 because the unique name will be called webpage2.Name etc.
We then have a Databast table which contains a unique string link (i.e. webpage1.Name as above) a Locale (i.e. English, Spanish etc) and then the localised (translated) string. We have a control which when a page is rendered iterates through each of the strings held in the resx file - works out what the unique name would be (i.e. on webpage1 it prefixes the name with webpage1 etc) and then based on the chosen locale it extracts the string from the database table and voila - localisable webpages.
There are probably many alternatives but the beauty of this is that since all the localised strings are stored as data - it can be exported, edited and added to simply through the db.
Plus you can write out the webpage in English - then deliver the strings from your db table to someone to translte into Japanese (for example) and then once the new Japanese strings have been imported you can then have a japanese version of your webite availabe without any rework on the website itself.
|
|
|
|
|
I like that very much! I'll play around with it. Any chance of seeing that code for the control (glenn_lanier at netzero dot net)?
Thanks for the idea - means a little more work to retrofit, but will make going forward much easier.
--G
|
|
|
|
|
Mark,
In working on this, I've created a literal for each of my bits of text (<asp:literal id="ABCDUnique">blah blah blah). I have other literals that are updated based on code execution, so that is the reason all literals start with ABCD.
In Page_Load, I do something like:
string pageName = "UniqueName";
languageCode = 1;
TranslateControls(pageName, this.Controls);
I then define the TranslateControls method as:
private void TranslateControls(string pageName, ControlCollection controls)
{
for (int i=0; i < controls.Count; i++)
{
Control ctrl = controls[i];
if (ctrl.HasControls())
{
TranslateControls(pageName, ctrl.Controls);
}
else
{
if (ctrl.GetType() == typeof(System.Web.UI.WebControls.Literal))
{
if (ctrl.UniqueID.StartsWith("ABCD"))
{
Literal litTemp = (Literal)ctrl;
Database db = new Database();
string textTranslation = db.GetText(pageName, ctrl.UniqueID, languageCode);
litTemp.Text = textTranslation;
}
}
}
}
}
Problem is, some controls are ignored -- when logging/stepping through, it appears that they are not part of the ControlCollection. Any thoughts/ideas?
Thanks,
Glenn
--modified to correct cut-and-paste error in sample
|
|
|
|
|
When page is initially loaded, all controls are displayed properly. However, on postback, some controls are missed and appear blank (odd, as they have initial text, and the db.GetText method returns either valid text or ctrl.UniqueID surrounded by underscores).
|
|
|
|
|
I need to fill a dropdownlist with 1 to 60. So I did it by doing the following code:
for(int i=0; i <=60; i++)
DropdownList1.Items.Add(new ListItem(i.ToString(), i.ToString()))
However, I was thinking this probally is not good idea to use "new ListItem" each time. So I replace the above with the following:
ListItem li = new ListItem();
for(int i=0; i <=60; i++)
{
li.Text = i.ToString();
li.Value = i.ToString();
DropdownList1.Items.Add(li)
}
But the result turned to be all the items in the list are 60. Is there anything in the second code wrong? I have seen people using the first code all the time, but bot the second code. Does anybody know why? Could anybody give me some ideas why the second code doesn't work?
What's the life cycle of the new item when using
DropdownList1.Items.Add(new ListItem(i.ToString(), i.ToString()))
The last IMPORTANT question is: Does using "new listitem" will cause performance issue, such as more memory allocation, etc?
I would really appreciate any ideas!
Thank you in advance!
|
|
|
|
|
In the second code you add the SAME list item 60 times. Now if you change the items text and value you change ALL items.
Everytime you add that listitem to the dropdownlist you add a REFERENCE and NOT a COPY to the list. You could, for example, add that listitem to another dropdownlist without any problems. And changing it would change the value in both dropdownlists.
I hope i could help you.
If not just say it
|
|
|
|
|
Thanks for your respones.
It looks like the first approach is the only way to programmatically adding item to asp:dropdownlist.
|
|
|
|
|
vicky457 wrote: The last IMPORTANT question is: Does using "new listitem" will cause performance issue, such as more memory allocation, etc?
Yes, it means you end up with 60 items, which is what you want. Otherwise, you have one item, which you keep changing the value of.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello all,
I've been searching all day for an article or tutorial on how to get data from a SQL Server 2000 database and export the data to excel 2003 so that multiple worksheets are created, and information is displayed in these worksheets. Data will be coming from multiple tables, and I'm using C# and asp.net 2.0. User will click on an asp.net button to pull the data and put it in an excel spreadsheet.
Thanks
|
|
|
|
|
I am trying out VS 2005 for the first time.
Didn't really like the website project, and installed the update for 'Web Application Project' to try it out.
But I am NOT able to view the Web Application Project in the project types when I try to create a new project?
Any help, what could I be missing?
Thanks in advance,
atul
|
|
|
|
|
Did you reboot?
Wep application project appears under the C# templates when I create a new project.
|
|
|
|
|
Hey,
Thanks for the reply.
Its really embarrassing for me to admit but I had not installed a pre-requisite!!!
Its working now for me.
On a side note, do you know why there isn't a namespace for the code behind when I create a new web page in WebSite project in .NET 2.0 ?
(its there for web app project)
Thanks,
Atul
|
|
|
|
|
Can anyone recommend a tutorial for GridViews ?
Specifically I want to highlight a row when the cursor hover over it. And I want to be able to select a row by clicking anywhere on it.
|
|
|
|
|
|
Thanks for your help - Digsy
|
|
|
|
|
|
Hi,
i'm using and i need to refer to a treeview control from another .aspx , any help would be appreciated..
Thanks
|
|
|
|
|
in the frameset drag ur aspx page....and ur problem is solved..
|
|
|
|
|
Heya guys and girls,
I am writing a CMS page for a quiz and want to use the new GridView control along with an in memory data store as a datasource.
Here is is how I would like it to work.
The user logs onto the CMS quiz page to add or edit a quiz. The quiz can contain any number of questions and answers and once the user has added a title for the quiz and as many questions / answers as they want they then move on to the next page to preview / confirm results.
The problem with using a GridView in the classic way would be that I would set it up with a SQLDataSource. this however would mean when I updated or added a row then the database would imedietly be updated. I need a way of storing an off line represention of the data and only applying the changes if the user confirms the preview of the data on the next page.
I have tried using a DataTable but I get told it does not implement IDataSource. I also need to GridView to handle a sitation where there is no data and we only need to add rows (in the case of adding a quiz).
Has anyone come across this problem before?
Cheers
Steve
"Gödel proved that any formal system that defines the primitive recursive functions must be either incomplete or inconsistent. In particular one could not prove from within the system that the system itself was consistent even though the question could be formulated within the system."
|
|
|
|