Forms Data Controls :: Load Formatting String From Web.config File?
Jan 13, 2011
I am trying to create a control, but I need to load my formatting string from my web.config file, but every time I try to run the program I get an error one the formatting line. show me the correct syntax to load this data?
[Code]....
View 6 Replies
Similar Messages:
May 25, 2010
I'm running into a really annoying problem with my Linq to SQL project. When I add everything in under the web project everything goes as expected and I can tell it to use my existing connection string stored in the web.config file and the Linq code pulls directly from the ConfigurationManager.
This all turns ugly once I move the code into its own project. I've created an app.config file, put the connection string in there as it was in the web.config but when I try to add another table in the IDE keeps forcing me to either hardcode the connection string or creates a Settings file and puts it in there, which then adds a new entry into the app.config file with a new name.
Is there a way keep my Linq code in its own project yet still refer back to my config file without the IDE continuously hardcoding the connection string or creating the Settings file? I'm converting part of my DAL over to use Linq to SQL so I'd like to use the existing connection string that our old code is using as well as keep the value in a common location, and one spot, instead of in a number of spots.
Manually changing the mode to WebSettings instead of AppSettings works untill I try to add a new table, then it goes back to hardcoding the value or recreating the Settings file. I also tried to switch the project type to be a web project and then rename my app.config to web.config and then everything works as I'd like it to. I'm just not sure if there are any downfalls to keeping this as a web project since it really isn't one. The project only contains the Linq to SQL code and an implementation of my repository classes.
My project layout looks like this
[code]....
Every time I try to make the default constructor look like the first way, it always auto changes back to the second way once I make a change to the file unless the DBML is inside of a web project.
View 2 Replies
Mar 29, 2011
In my repeater I am attempting to set the label format based on a value from my datasource. The following line from my repeater is straightforward enough but now how would I modify it if I wanted the "C2" statement in the ToString to pull from a field in my datasource named "MyFormat" which would contain either the C2 or N0 value? Basically switching the formatting for that label between currency and a double?
<asp:Label runat="server" ID="lblValue1" Text='<%# Convert.ToDouble(Eval("MyValue")).ToString("C2") %>'></asp:Label>
I've attempted to simply insert a statement such as Eval("MyFormat") in place of the "C2" statement but to no avail.
View 2 Replies
May 4, 2010
I have the following code that works fine:
[code]....
View 7 Replies
Feb 17, 2011
i have a store procedure that load data in a table of SQL SERVER 2008 from an excel file.the issue is, that the excel file have a column of DATE type, and i want that the system interprets the format in it, no matter what comes in it.dd/MM/yyyy mm/dd/yyyyi have an argue about this with my parnerts, cause i think is imposible, if you don't have a format before the process runs.
View 3 Replies
Jan 7, 2011
I am having trouble formatting the date on a textbox I get the error above if I don't enter the date in MM/DD/YY format in the textbox. I am also using this in a FormView so I can't format it or don't know how to in the code behind so if there is a way to format it in design view that would be preferable. Does anyone have any ideas on how I would do any of this.
<asp:TextBox Text='<%# Bind("BIRTH_DATE", "{0:d}") %>' Font-Names="Tahoma"
Font-Size="X-Small" ToolTip="MM/DD/YYYY" ID="txtBirthDate" runat="server"
TabIndex="2" CssClass="style5"></asp:TextBox>
View 2 Replies
May 7, 2015
How can encrypt the web configuration file ... so I don't want the connection name is appeared. How to do ncryption of web config file.
View 1 Replies
Nov 29, 2013
I want to encrypt my web config when i deploy it to server so that the username and password of database is secured. I've tried some of the encryption and it did'nt work. here is my code.
Imports System.Collections.Generic
Imports System.Text
Imports System.Configuration
[Code].....
View 1 Replies
Feb 1, 2013
I my exporting data through dataset to excel. But one column say awb no having datatype nvarchar contains long int no say : 123456789012345.
Then instead of displaying this no in numeric format(123456789012345) it is displaying in exponent form(1.23457E+19).
Is there any way to stop this i want data in numeric format (like this 123456789012345).
View 1 Replies
Jan 30, 2010
I am very new to ASP.Net and Visual Studio 2008. I am attempting to run a website on my Windows 7 Enterprise usig IIS7. When I load the web.config file in the VS2008 editor I get several errors/warrnings. Each starts with "Could not find schema information for the element 'TinyMCE' or it specifies one of the attributes.The section of code looks like this:
<TinyMCE installPath= "script/tiny_mce" mode ="src"
<globaoSettings>
<add Key ="relative_urls" value ="false" />
[code]...
View 4 Replies
Jul 30, 2010
how to write connection string in app.config file in vb.net windows application and how to call connection string in forms
View 2 Replies
Jan 15, 2010
why we use connection string in web.config file??? Or what is the benefit of using connection string in web.config file?
View 7 Replies
Aug 6, 2010
I am having trouble connecting to a ms sql database on the server. The hosting company said that the .sql file was imported successfully, but when I try to use the 'login' or 'create account' features im getting an error page saying:
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. make sure the user has a local user profile on the computer. The connection will be closed.
I am sure all the connection info is correct so it is really frustrating trying to work the problem. I have listed the connection string in my web.config file to see if anyone can see anything wrong with it.
View 4 Replies
Feb 3, 2011
I have this in the web config file <connectionstrings> section. Why is there an add and then remove and then again an add...what is it trying to accomplish here? and in the second code section, I use that string in a sqldatasource control. Second question: Can I just use the name attribute value "localsqlserver" form web config file, in place of the connection string in the data source? is it why that attribute is for?
[Code]....
View 2 Replies
Jun 19, 2010
My requirement is to save the connection string of database that will be provided to be me by user on form, which can be modified lator.
i need to know how and where i should store the connection string permanently which will be used lator to connect to database.
View 1 Replies
Jul 30, 2010
I have written the web.config for same server without username and server and its working.
but not been able to provide the username and password in web.config file.
Following is my web.config for Server:
[Code]....
I have to write another web.config for client application with username and passoword. how could i use it.
server name is "BM", User is "Sa" and Password is "abc"
View 11 Replies
Jun 28, 2011
How to programmatically write an encrypted connectionString to a Web.Config file?
View 5 Replies
Jun 19, 2010
I'm facing very odd problem with my application. I've been developing my own custom memberhip provider (derived from MembershipProvider, of course) and everything was working smoothly, until something odd happened. In my config file, I register my provider with such code:
[Code]....
When I deploy my site, I get this error message:
Configuration Error
Description:
An error occurred during the processing of a configuration file required to service this request. review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Input string was not in a correct format.
Source Error:
Line 62: <clear/>
Line 63: <add name="CustomSqlMembershipProvider"
Line 64: type="My_Membership.CustomSqlMembershipProvider"
Line 65: applicationName="My Application"
Line 66: enablePasswordRetrieval="false"
View 6 Replies
Jun 24, 2010
how can i load the contents of an xml file at a url into a string? eg there is an xml file at [URL] I want the text of the xml to be assigned to a string. How can i do that using c#?
View 2 Replies
Aug 23, 2010
I want to show just a part of a string for example:
Instead: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."
Just a: "Lorem ipsum dolor sit amet, consetetur sadipscing..."
Which method can I use to do that?
View 3 Replies
Nov 9, 2010
I will explain the my current yet simple architecture of my application(s). At the moment I have my main web application as a separate project. I then reference the CoreBLLDAL (Business Logic and Data Access) Project so that several projects can have access to the BLL/DAL Project.
Within the CoreBLLDLL Project I use TableAdapters for my DAL.
I have just upgraded to VS2010 and I would like to make use of the Config Transforms, allowing me to have a separate web.config for test and production - however, TableAdapter get the connection string from the Settings.settings file.
How can I change the TableAdapters to get the connection string from the app/web.config file? I read that you can change this within the designer file for the TableAdapters by using ConfigurationManager, however, I tried this but I do not have access to the ConfigurationManager namespace. I presume this is because the project is a class library and not a web application - I am not too sure.
View 2 Replies
Sep 23, 2010
Is aspnet_regiis.exe secure? If i encrypt using aspnet_regiis.exe, will it automatically decrypt the string and wont give any error? Need an insight into this stuff.... Is Rsa the best option or wat? Wat's the best way to encrypt/decrypt programmatically?
View 10 Replies
Sep 8, 2010
I am trying to read a normal string from the web.config file. When I try to read a string from the web.config file the application doesnt seem to read it. I set my sqlconnection string in the web.config file. It reads a sqlconnection string but not a normal string.Here is my code:
web.config file:
<applicationSettings>
<MyApplication.Settings>
<setting name="Colour" serializeAs="String">
<value> "Red"</value>
</setting>
</MyApplication.Settings>
</applicationSettings
This is how I try to call the setting:
string strColour = Properties.Settings.Default.Colour;
I am using .net framework 4.0
View 2 Replies
Mar 15, 2011
just for my testing purpose i know i can define both the connection's outside in a single web config file by different name's and access them in my front end according to it but what if i want to have seprate for both connection's web.config situation is like this see image so i want to access my connections from second web config file how i can do that.
[Code]...
i tired this but its giving error
[Code]....
View 1 Replies
Oct 6, 2010
I am fetching data from MySql database.When i look at the object it looks like this:But when this object is converted to String then it appears like this:The Formatting of the object is gone..How can i get/show the original formatting that is fetched from the database..
View 5 Replies