DataSource Controls :: SQL Datasource Populating Drop Down List?
Apr 7, 2010
I have a SQL Datasource populating a Drop Down List with Company Names. The Select Statement the Datasource uses selects Company ID and Company Name.When a company is selected from the list, there is a button on the page to continue processing with the selected company. On the press of the button, I want to set a session variable for the Company ID of the Company selected. This Company ID is obviously held in the Datasouce. Any idea how I get at the Company ID.My code will look like the following:Session.AddsessCompanyID", ????????????)where ?????????? represents the source of the Company ID.
View 5 Replies
Similar Messages:
Apr 16, 2010
I am trying to populate table column names into a dropdown list . how can I query using Linq to SQL to just get the list of few Column names ? in a method in DAL which I can use to load in my UI page !!
View 2 Replies
May 11, 2010
i have a small app. the database has two tables. Category(CategoryId, Category), Quote(Id, CategoryId, Quote) these two tables are related via FK (CategoryId). In my page i have a simple drop down list, button and lable. user selects a value from drop down list like 'politics', 'comedy', 'famous' etc and then they hit the generate quote which should fetch a quote from the quotes table by passing a value like 'politics'.
however, i need to pass an int value (ID) from my drop down since that is the value which will fetch corresponding quote using my SP but (1) how do i pass a drop down value's ID and (2) is the SP below correctly done?
SP code:
ALTER PROCEDURE [dbo].[GetQuote] (@CategoryId VARCHAR(2))
View 7 Replies
Jan 27, 2011
what the problem is that i want to populate drop down list manually
but the thing is i have 3 drop down lists
in first one user will select table name from where the data of 2nd Drop Down list will come
suppose user selected seo then the sql query would be select project_name from dropdownlist1.selecteditem
and this query will show project_name column of seo table in dropdownlist2
then user will select any project name from dropdownlist2 suppose he select salveo so i want that my text box will get populate with project_id of project_name
suppose the project_id of salveo is 123 then automatically in textbox it will enter 123
View 26 Replies
Mar 7, 2011
I have 3 drop down boxes, created using the HTML select tag. On page load, the first box has a few names. Now, when I click on one of the names in the first box, some more names should appear in the second and when I click on a name in the second box, some more names should appear in the third box. How can I achieve this using AJAX? I have to use ASP.Net and MS SQL Server only. I'm a complete noob to AJAX and I've been educating myself about it, but nothing's working out. I've been looking for the code for close to a week. I looked up w3schools.com, but when I tried that code, it didn't work. Please help me out and please tell me step by step, the things required in order to make it work, and what goes where. I have a deadline that is fast approaching and am at my wit's end trying to make it work.
View 1 Replies
Apr 7, 2010
I'm trying to retrive data from an SQL server db and populate one of the columns into a drop down list.
View 7 Replies
Jun 15, 2010
I have a upload control and a dropdown list for files i want to upload. The dropdown list contains the 5 types of documents I am uploading.
When I upload the file into sql, I see it makes it there. However, the column that should be changing from 1-5, based on my selection, is changing from null to 0.
aspx:
[Code]....
View 4 Replies
Jun 1, 2010
I am getting an error "Unable to cast object of type 'System.Int32' to type 'System.String'."when attempting to loading data from a stored proc. My database code is
[Code]....
[Code]....
View 7 Replies
Mar 11, 2010
I'm creating a user control that enables users to search AD and add the selected names to a list (which is used to send mail lateron).
The problem is that the search results end up in the Listbox but all as the string "System.DirectoryServices.ResultPropertyValueCollection" in stead of the actual values.
I have no idea why.
This is my code:
[Code]....
[Code]....
View 5 Replies
Oct 5, 2010
I need to populate a text box from a stored porcedure call that does not have any parameters. I've made the database connection and am executing the stored procedure, but I cannot figure out how to set a text box value to the return value of the stored procedure. BTW, the stored procedure only returns one value.
View 2 Replies
Sep 29, 2010
Here is what I have tried:
txtCost.Text = string.Format("{o:c}", dr["Cost"]);
Here is the error I receive. How can I format the data that is coming from the data reader into currency format??? Also, is there a way to format it into currency without the dollar sign?
Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
View 4 Replies
Apr 11, 2010
I'm looking for a steer on how to go about running stored procs efficiently.
I have a current requirement to populate a control, so I have all the specific data i.e the parameter value I need to pass and the control I want to populate, plus generic data such as SqlConnection etc.
I'd like to be able to call, say, "MyStoredProc". MyStoredProc would contain all the necessary information to run the proc, but then pass onto a method, say, GetSpData, which contained all the generic stuff about running stored procs.
Then when setting up MyStoredProc2 I could do without repeating a lot of the original function
Im I barking up the wrong tree or is there an efficient way of managing this kind of situation.
View 2 Replies
Apr 27, 2010
How can i Drop Multiple table through an SQL Statement rather than using a procedure or a function.
View 7 Replies
Dec 22, 2010
I'm populating a grid view with data from an SQL datasource. The database has a a list of performing artists and lots of details. The gridview initially, shows the ArtisID (Primary key) , and artist name and music style. So far this is all simple and easy. This is done.
Now I want to be able to click on the ArtistId (Select Column) and move the customer to another page where I show indepth details about the artist. How do I do this???
In Vb.net I had a 'Celldoubleclick' event, and I redirect the client. But how do I accomplish the same in asp.net? I already have the primary key value
primekey = datagridview.selecteddatakey.value
View 4 Replies
Mar 30, 2010
I have a drop down list that has the initials of about 12 of our sales guys.How can I make it so that when they select their initials from the list, the next drop down list only shows their customers.In my database there is a column for customer name and salesman.
View 6 Replies
Feb 3, 2010
I have a database that a website uses. It is working fine but I went into enterprise manager and I can't see it in the list of databases. When I try to attach the mdf file I get this error.TITLE: Microsoft SQL Server Management Studio
View 3 Replies
Apr 18, 2010
how to get records from database and display in datagrid w/o using dataset/datareader?my requirement is not to use Using System.Data namespace
View 5 Replies
Jun 24, 2010
I have drop down list box that I would like to show two columns, is this possible? Or can it be done with a list box?The query correctly retrieves all of the table data to be displayed, one colum is an abbreviation, the other a bit longer description.
View 2 Replies
Jun 17, 2010
I have a series of SQL database tables but would like to be able to have a table entry that can support a list of primary key's for another table - how I can do this?
View 1 Replies
Jan 17, 2010
I use MySQL database and SqlDataSource controls. I generate update and insert queries in my code behind.how I can get a list of columns from the SqlDataSource control?
View 2 Replies
May 8, 2010
I am trying to create linq from A list:
[Code]....
But I always get this error:
[Code]....
I'm using this class to do search:[URL]
View 8 Replies
Jun 2, 2010
Need ideas on how to do this. I have a page where I'm adding a new object.This is a row in a db table. This object has a list of other objects associated with it.I want to be able to define the sub-objects before adding the new object. Does that even make sense??
I was thinking somehow using the object datasource would be a good way to manage this. That way when I add the object, just loop through the object datasource to get the sub-objects to add. How would I achieve this with the object datasource, or am I even going about it the right way?
View 5 Replies
May 6, 2010
Given an XML id list pulled out from a User Profile, how can we best program to use that list to retrieve text records from a SQL table and populate a dropdown list which contains ids from the XML list and text values from the SQL table.
View 3 Replies
Oct 13, 2010
I'm not expecting a full solution here (unless you really want to), just some tips and pointers.
I have a User table and an Area table. The User table has userID, userName etc., and the Area table has areaID, areaName etc.
I'm binding the list of Areas to a checkboxlist where the user MUST choose between 1-3 options. I'm using a stored procedure to update the DB.
Is there a common solution to this problem that I haven't found?
I have thought about saving it as a comma separated string in a field in the user table. This looks like a temporary and ugly solution though, do you think?
A nicer solution would be to create a UserArea table where I save the ID's as foreign keys from areaID and userID. But I don't know how to write this stored procedure where I update and insert the choices made.
View 5 Replies
Apr 22, 2010
[Code]....
than i want present data like this
[Code]....
[Code]....
but data doesn't appear on webPage ?? what's wrong with this code ??
View 5 Replies