Forms Data Controls :: Get A Specific Value Out Of A Dropdownlist?
Nov 30, 2010
OK, I have dropdownlist bound to a datasource with the following query:
"select ccid, buname from tblCostcenter;"
I have the dropdownlist set to show only the "buname" column.
Now, when the user makes a selection for my dropdown, I want to grab only the selected value of the "ccid" column - even though "ccid" is not set as the text or value for the dropdown.
View 4 Replies
Similar Messages:
Mar 11, 2011
I have a situation where i need to update my Dropdownlist templatefield inside a GridView....but only for a specific cell. I have seen codes like this to loop through the whole GridView and update every rows in a specific column, but how do i do it if i only want to update one specific cell ? (If i know the index information of the cell, for example, I know i want to update the dropdownlist on Column 3 and Row 2)
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
this.WorkTypeDDL = ((DropDownList)row.FindControl("WorkTypeList"));
this.WorkTypeDDL.DataSource = AL;
this.WorkTypeDDL.DataBind();
//more codes blah blah blah//
}
}
View 3 Replies
Aug 25, 2010
its possible to use a DropDownList within the PagerTemplate to navigate to a specific record? I have been able to place the DropDownList outside of the FormView and PagerTemplate and make it work, however, I can't get it to work inside the PagerTemplate.
View 2 Replies
Sep 30, 2013
i have on dropdown, i want to set specific selected item at top of dropdownlist box when binding items inside dropdowlistbox.
View 1 Replies
Mar 29, 2011
I have a table and 7 column name.
I bind the 7 column name in one dropdownlist.
Now the problem is,how do I extract the data value in a dropdownlist?
For example,
Dropdownlist contain 7 column name
-subject_name
-subject_code
-venue
-time
-seat_no
-admission_no
-subject_id
when I click the subject_name,I want it to appear in a gridview
Example
Math|9.00-10.00|Hall|18|09090J|...
Below is my current codes which I have a problem.
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source= EN\SQLEXPRESS;" + "Initial Catalog=ms;Integrated Security=SSPI");
SqlDataAdapter adapSel;
string mySQL = "SELECT '" + dd_list.SelectedValue+ "' FROM examtimetable ";
adapSel = new SqlDataAdapter(mySQL, conn);
conn.Open();
DataSet dsSel = new DataSet();
adapSel.Fill(dsSel);
GridView1.DataSource = dsSel;
GridView1.DataBind();
conn.Close();
}
Previously I have bind 7 column name in my dropdownlist
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
SqlConnection conn = new SqlConnection("Data Source= EN\SQLEXPRESS;" + "Initial Catalog=ms;Integrated Security=SSPI");
SqlCommand sqlCmd = new SqlCommand("select column_name from information_schema.columns where table_name='examtimetable' and COLUMN_NAME not like '%ID'", conn);
conn.Open();
SqlDataReader ds;
ds = sqlCmd.ExecuteReader();
dd_list.Items.Clear();
dd_list.DataSource = ds;
dd_list.DataTextField = "Column_Name";
dd_list.DataValueField = "Column_Name";
dd_list.DataBind();
dd_list.Items.Insert(0, "Select Option");
ds.Close();
conn.Close();
}
}
View 10 Replies
Mar 28, 2011
Currently,below is my code.
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source= E\SQLEXPRESS;" + "Initial Catalog=k;Integrated Security=SSPI");
SqlDataAdapter adapSel;
string mySQL = "select column_name from information_schema.columns where table_name='examtimetable' '" + dd_list + "'";....
I receive an error "Incorrect syntax near 'System.Web.UI.WebControls.DropDownList'."
View 3 Replies
Mar 8, 2010
I want to making another dropdownlist visible=false when clicking in dropdownlist on the same detailsview?
View 4 Replies
Dec 2, 2010
I am using 3 dropdown list in a gridview and the values for the dropdownlist is dynamic from database.based on first dropdown list selected value the values must fill to second dropdown and based on second dropdownlist selected value then items should load to 3rd dropdown and same for 4th dropdown list. Here if i select age,gender,sex, fist name, last name from the template name Human. The first drop down only populate the fields like Age,gender,Sex and so on., When the second dropdown list populate from the fields corresponding Template name Human, Finance, and so on.
View 3 Replies
Mar 14, 2010
I am trying to figure out how to associate a specific user to a specific data on the site, like social networking site.
View 3 Replies
Jun 14, 2010
I'm trying to access and display certain data in my database using category ID's. I've added values to the links in a link list and I was to have the selected value as the one that determines the selection in the selection statement. For example, "SELECT [ID_key] AS ID_Key, [Title], [Source], [PublicationDate], [Url], [CatID] FROM [Newsarts] WHERE ([CatID] = Linklist1.SelectedValue)". I know Linklist1.SelectedValue doesn't work or it may work and I don't know how but I want to be able to use the value selected from the previous link. Is there a way?
Also, after all the data is displayed, I would like them to become links themselves. Basically, I want to choose a category, then choose an article in that category, and they hit the link to display the article's content.
View 2 Replies
May 25, 2010
I have a gridview which I have databinded via the quick config facility, but I need to databind one column to a completely different sql table data field - how do I do this?
If I go into Gridview tasks and select the column and edit the data binding parameter but what is the format for a table outside the source definition for the the rest of the gridview?
View 4 Replies
Jan 10, 2011
so I am new to ASP and I am confused here about how to obtain specific data from a specific cell.so, i have a gridview that i fill from a SQL source, this works fine. what i have been task to do is add an editable text box and a comments portion to the site. these controls are to be inside the gridview. my dilema is getting the primary key of the row i am inside of.
Example when i click in the text box i created and i change the text the "ontextchanged" event fires; however, i am having difficultly at that point getting the primary key from column [0] of that specific row. i need this so that i can update the database.here is some of my code
ASP (Markup)
[Code]....
Code Behind (it is blank becuase i have run out of ideas and need your help filling it)
[Code]....
View 3 Replies
Aug 7, 2010
I am trying to display data from my database using FormView. However, I only want data for the currently logged in user to be queried. The database already contains the UserName for each user.
View 3 Replies
Aug 11, 2010
I need to retrieve data from two columns then view them into page.aspx,,,, this is the code I used
<asp:DataList
ID="DataList1"
runat="server" [code]......
View 21 Replies
May 13, 2010
I need to retrieve data from DB and show it in specific way:
3 columns and 4 rows on each page
For example:
if I retrieve sequence from 1 to 50 the result should be represented in following way:
Page 1:
1 2 3
4 5 6
7 8 9
10 11 12
Page 2:
13 14 15
16 17 18
19 20 21
etc....
How can I achieve such representation?
Should I do it with repeater?
View 3 Replies
Jun 23, 2010
get the specific column value from gridview.
View 5 Replies
Feb 16, 2010
How do you get a value in a specific row and column of a gridview assigned to a variable ?
View 2 Replies
Jun 30, 2010
I want allow edit the only specific rows in gridview.
How can I achieve this.
View 4 Replies
Nov 16, 2010
I am using VS2003. How do I get specific cell of datagrid?
View 2 Replies
Jun 3, 2010
Accessing GridView Element of specific row?
GridView1.DataSource = newDs;
View 3 Replies
Jul 27, 2010
How to set my DetailsView to show a specific record for I which catch it's datakey from a text box ??
DetailsView is already bound to a datasource (in this case from an Access database file):
[Code]....
The "SqlDataSource1" uses a connection string "nwind" set in web.config.
I would like to do this in C# (code behind) and I store the "datakey" in a "s" string variable. After this I'm lost..
View 9 Replies
Apr 10, 2010
CheckBox Passing a specific Value to an SQL Column the object I am trying to reach is to pass a value "true" via a checkbox nested inside a GridView to a SQL Table.
This is how the control is nested inside the GridView:
<asp:GridView runat="server">
<Columns>
<asp:TemplateField >
<ItemTemplate>
<asp:CheckBox runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
This value should be passed when I update the GridView and I don't figure out how this can be accomplished.
View 3 Replies
Jan 6, 2010
I have a site which displays data form a MSAccess 2003 database in a DataGrid. For simplicity sake the data is products ie an ID, Name, Description and a value representing the amount in stock.I want to allow the user to update the stock field via the datagrid but not be able to change any of the other fields. Is this possible?
View 5 Replies
Nov 23, 2010
Here's the background: I have a GridView with suggested meetings. A logged in member can view the suggested meetings and click button "Show" to view all suggested occasions for every meeting. What I want to do now is to hide button "Show" for a logged in member if she/he owns the meeting (i.e. is the one who suggested it = Session["memberID"]).
My problem is this: All buttons "Show" are visible. I want to hide button "Show" in those cases where Session["memberID"] is identical to dr[0]. 'ID' in the SQL statement is the ID of the meeting in the database and meetingID are the ID's of the meetings shown in the GridView.
Here's the code:
[Code]....
View 4 Replies
Apr 9, 2010
I have a gridview that has both a select and an update statement. One of the cells is a date cell, and the other is for numerics only. Is there a way I can do this? At the moment, anything can be keyed into the cells and this results in an error as my update stored procedure expects a date value and a numeric value respectively.
View 2 Replies