.net - Multiple Values For A Single Config Key?
May 12, 2010
I'm trying to use ConfigurationManager.AppSettings.GetValues() to retrieve multiple configuration values for a single key, but I'm always receiving an array of only the last value. My appsettings.config looks like
<add key="mykey" value="A"/>
<add key="mykey" value="B"/>
<add key="mykey" value="C"/>
etValues("mykey");
View 4 Replies
Similar Messages:
Feb 19, 2010
[code]....
I am having Table called Interest and has only one column named Answer...
i want the checked values to insert in database..If i select Family, News and Fashion... The inserted data should be in Three rows of answer field..
View 3 Replies
Mar 28, 2011
I am trying to populate the values of multiple rows in single row in gridview using c sharp in rowdatabound section of code behind page like:
Col1 Col6
a 1
a 2
a 3
a 4
I have changed this to
Col1 Col6
a 1
2
3
4
Now I want to achieve this?
Col1 Col6
a 1 2 3 4
What wrong with the code below?
if (e.Row.Cells[0].Text == "" && e.Row.Cells[5].Text != "")
{
for (int a = 0; a<GridView1.Rows.Count; a++)
{
string s = GridView1.Rows[a].Cells[5].Text;
GridView1.Rows[e.Row.RowIndex - 1].Cells[5].Text += s;
}
}
What mistake I am making?
Cell[0] is Col1
Cell[5] is Col6
View 1 Replies
Aug 4, 2010
i use this to select one checkbox to isselected column how i convert this to multi checkboxlist to single column i use many ways more than 3 days without success
private void BindCheckBoxList()
{
DataTable dt = new DataTable();
SqlConnection connection = new SqlConnection(GetConnectionString());
try
{
connection.Open();
string sqlStatement = "SELECT * FROM boby";
SqlCommand sqlCmd = new SqlCommand(sqlStatement, connection);
SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
sqlDa.Fill(dt);
if (dt.Rows.Count > 0)
{
CheckBoxList1.RepeatColumns = 4; // set the number of columns in the CheckBoxList
CheckBoxList1.DataSource = dt;
CheckBoxList1.DataTextField = "Name"; // the items to be displayed in the list items
CheckBoxList1.DataValueField = "Name"; // the id of the items displayed
CheckBoxList1.DataBind();
//Setting the Selected Items in the ChecBoxList based from the value in the database
//to do this, lets iterate to each items in the list
for (int i = 0; i < dt.Rows.Count; i++)
{
if (!string.IsNullOrEmpty(dt.Rows[i]["IsSelected"].ToString()))
{
CheckBoxList1.Items[i].Selected = Convert.ToBoolean(dt.Rows[i]["IsSelected"]);
}
}
}
}
catch (System.Data.SqlClient.SqlException ex)
{
string msg = "Fetch Error:";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
connection.Close();
}
}
private void Update(string name, bool isSelected)
{
SqlConnection connection = new SqlConnection(GetConnectionString());
SqlCommand cmd;
string sqlStatement = string.Empty;
try
{
connection.Open();
sqlStatement = "UPDATE handymen SET IsSelected = @IsSelected WHERE Name = @BizName";
cmd = new SqlCommand(sqlStatement, connection);
cmd.Parameters.AddWithValue("@Name", name);
cmd.Parameters.AddWithValue("@IsSelected", isSelected);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
}
catch (System.Data.SqlClient.SqlException ex)
{
string msg = "Insert/Update error";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
connection.Close();
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindCheckBoxList();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string str = string.Empty;
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Selected)
{
str = CheckBoxList1.Items[i].Text;
Update(str, CheckBoxList1.Items[i].Selected);
}
}
//ReBind the List to retain the selected items on postbacks
BindCheckBoxList();
}
View 3 Replies
Jun 29, 2010
i have one hidden field and i want to bind it with two values of my data base separated by an coma. some thing like
->asp:HiddenField ID="hfRstidDate" runat="server" Value=<%# DataBinder.Eval(Container.DataItem, "tsk_ID"),DataBinder.Eval(Container.DataItem, "Date_Worked").ToString())%>
View 1 Replies
May 7, 2015
i want to pass multiple arrays variable in query string.for example i have three checkbox list Brand ,Price, Attribute any arrays variable may have more than one value key arrays variable are fixed for checkboxlist
1-checkbox list Brand has Brand []arrays variable
2-checkbox list Price has Price []arrays variable
3-checkbox list Attribute has Attribute []arrays variable
now i have selecting two -two from every checkbox list .than i want to query string something like this
www.defualt.aspx?brand[]=samsung=123&apple=11,Price[]=100=12&200=2,Attribute []=camera=1&display=2
View 1 Replies
Aug 24, 2010
I want to store employee name,designation and department in session variable and retrieve in another page how to do this.
View 2 Replies
May 25, 2012
Currently I have a grid view with few rows of data & edit and update for each row but I want it to be done on a single click with w external edit & save button how can the functionality be performed.
View 1 Replies
Feb 19, 2010
I'm trying to implement a 'remember me' functionality on my website to allow the users to remain logged in without having to login again.
ity.FormsAuthentication.SetAuthCookie(userName, true);
I've noticed that the 2nd parameter (createPersistentcookie) is not really persistent as it depends on the timeout value set in the config file.
View 3 Replies
May 19, 2010
I have a stored procedure that returns 3 tables within the single recordset it returns. If I set a SqlDataSource to get data from this procedure, it works, but it only returns the first table. I want to have a GridView display the data from the 2nd or 3rd table using a SqlDataSource, but I can't figure out how to specify a particular table.
While there are some posts discussing this out there, I can't get a definitive answer about whether or not this is even possible (?). In a worst-case scenario, I can create another SP that only returns the 3rd table - but that creates a little maintenance headache that I would prefer to avoid.
View 4 Replies
Jan 12, 2011
below written question :
1.) What is the name of the OS process in which App Domain resides.
2.)if suppose There are Three Windows application hosted on a same envoirment and two instance is working for each application at a Time, means now total instance are six .what will happen among the below written cases :
a.) There will be six different app domain in a single OS process
b.) There will three app domain(one for each application) in a single OS process and some Parallel thread will be executed in each app domain for another instance.
c.) There will be Three OS process corresponding to each application.
3.) If eveything will remain same except there are three web application in place of windows in point 2, will there be any change in functioning.
View 1 Replies
Aug 18, 2015
I have a question in gridview, I want to combine my two or more records into a single cell with two rowsfor Example i have a ID, Name, Year Start, and Year End for Column name in database and i want call it into my gridview that the Year Start and Year End will combine to Year like:
In Database
ID Name Year Start Year End
1 Yourname 2010 2015
In Gridview:
ID Name Year
1 Yourname 2010 2015
in a year column i want it to two row..
View 1 Replies
Aug 18, 2015
I want to bind three column with one row in gridview in asp.net with c#,
i want like this,
Name | Info
----------------------
name | lastname
| phone number
| address
I get this by default
name | last name | phone number | address
View 1 Replies
Mar 8, 2011
I currently cache everything possible on my site (images, JS, CSS). There is only one JS file that I need to be loaded fresh every single time. How do I omit just one file from caching, using web.config, whilst leaving everything else cached?
Note that I tried another link here, and it didn't seem to stop the caching of my file: How do I disable caching of an individual file in IIS 7 using weserver config settings
View 2 Replies
May 26, 2010
I have a virtual directory setup in one of my web apps that needs to not inherit the web.config of the main app so it can run on it's own. I am wondering how I can do this because right now when I hit it (mainwebapp.domain.com/virdir) it throws an error saying it can't find some dependencies that are listed in the main apps web.config (shows main app web.config in the error message), this virdir contains it's own little app that needs to just run standalone.
Here is the problem area:
[code]....
error is on line 145: "Could not load type 'Weborb.ORBHttpHandler'." (this is the parent web.config that it is showing the error in, which I do not want to modify)...
If I add <clear/> to the top of that same block in the child web.config then I get:
"No http handler was found for request type 'GET'"
View 1 Replies
Mar 30, 2011
I'm very new to ASP.net, so I'm just figuring this out.First off, I have multiple separate projects that will be hosted on the same server.Second, they must be able to share certain settings (like connection string, configuration options, etc).Third, those shared settings must be configurable for different deployments (test, prod, etc).
View 1 Replies
May 13, 2010
14 days ago all emails were being delivered without any error, but now none of the email is delivered neither from local site nor from hosted site.I did not change any single letter of code in web.config and in pages.
Web config file is as follows.
<appSettings>
<add key="MailFromAddress" value="<user name>@gmail.com"/>
<add key="MailToAddress" value="<user name>@gmail.com"/>[code]....
and under system net
<system.net>
<mailSettings>
<smtp from="Jack <<user name>@gmail.com>" deliveryMethod="Network">[code]....
And the page that sends message is as follows
myMessage.From = New MailAddress(AppConfiguration.MailFromAddress, AppConfiguration.SenderName)
myMessage.To.Add(New MailAddress(AppConfiguration.MailToAddress, AppConfiguration.ReceiverName))
Dim mySmtpClient As New SmtpClient()
Try
mySmtpClient.EnableSsl = True[code]....
On debugging it always fires the catch block. Earlier I never had such problem with emails but for last few days none of the email is being delivered.Is it my system problem? Is it any port no. issue? My local site and remote site are not delivering any message. what could be the reason and how I make it functioning as before.
View 10 Replies
Aug 9, 2010
Background: I use stored procedures exclusively for an ASP.NET application. I am using a DataReader to load a dataset object.
View 4 Replies
Feb 18, 2011
Possible Duplicate:
How to apply the asp.net authorization in two different folders ?
How to use the multiple login for multiple folders ?
i have two different login pags in folders ADMIn and VEndors ...i want when any of the user directly access any of the page inside admin folder then it redirect to login page of Admin folder ......and if any of the user directly access any of the page inside Vendors folder then it redirect to login page of Vendors folder ......
View 1 Replies
Oct 5, 2010
How can I put MembershipProvider, ProfileProvider and RoleProvider in one single external config file?
View 1 Replies
May 7, 2015
i showed two column (Electronics,Photoshop) but i have six. i want to update their checked or unchecked condition in database (0,1) how do i do?
<asp:CheckBox ID="CheckBox1" runat="server" Text="Electronics" />
<asp:CheckBox ID="CheckBox2" runat="server" Text="Photoshop" />
<asp:CheckBox ID="CheckBox3" runat="server" Text="VideoEditing" />
<asp:CheckBox ID="CheckBox4" runat="server" Text="Gaming" />
<asp:CheckBox ID="CheckBox5" runat="server" Text="Coding" />
<asp:CheckBox ID="CheckBox6" runat="server" Text="Miscellaneous" />
View 1 Replies
Oct 5, 2010
i have multiple tables .
I have created one stored procedure where I am selecting the table values.
like
[code]....
I am using LINQ to retrieve the Data. So Using Linq I am calling the stored procedure.
So I ll get the table values in the C# Code the table values.
so in my UI i have 4 gridviews.
I want split the output values into four source and bind it to the grid.
View 1 Replies
Feb 3, 2010
Below is the jquery script that takes one input value from textBox1 and pass it to a web method then returns the name of the person and displays it in textBox2. The web method only takes one parameter, the user initials.
[code]....
I want to be able to pass two values from two textboxes for a web method that requires two parameters. how can I modify the jquery code above to accomplish that?
View 4 Replies
May 5, 2010
Is there a way to copmile a solution into a single dll?
Said solution may have several custom projects. I want all of them, and all the third party dll's they reference compiled into a single dll.
View 5 Replies
May 1, 2010
In a typical business application, a session is started and persisted across several pages. It is commited only when the transaction is complete. A good example of this is a tax preparation application. Once the session is started, it is persisted through session, cookies, or both. Nothing is written to file, or database, until the entire profile is complete and the refund/return is calculated. In such an ennvironment, is makes a great deal of sense to work with the structure imposed by domain driven design, and using a single repository to simple commit the session. However, there are times when this doesn't translate correctly, even when domain driven design is used.
An example of this is my forum project. While the entities themselves are good targets for domain driven design, I am not sure about the repositories. The basic structure is that a Category has many Forums, a Forum has many Threads, and a Thread has many posts. There are other things in there, but that's enough to describe what I want to get across. If a user has navigated to /Thread/Edit/42, and they have rights to edit it, all I am concerned about is fetching that record and displaying it. On postback, all I want is to be able to save it..................
View 2 Replies