Forms Data Controls :: Load Values From Database To Dropdown Before AddQuotenumber Button?

Mar 11, 2010

I have Dropdown for Quotenumber(auto increment ).i have created a function to retreive the data from database.data loading into dropdown. when i click on Addquotenumer button the new quotenumber generated and same loading into dropdown but 2 set of Quotenumbers are displaying rather than singleset, i debudded the code the reason was i have called this function twice one is form load and another one in AddQuotenumber button event,both should manadetory as per my requirement. how can un load this dropdown before AddQuotenumber button

Function to retreive data to dropdown
Public Sub retriveDataToDropDown()
Try
Dim connectionString As String = "Database=fabdb;" & "Data Source=localhost;" & "User Id=root;Password=pacvision"
Dim query As String = "SELECT QuoteNumber FROM quotes"
Dim connection As New MySqlConnection(connectionString)
Dim da As New MySqlDataAdapter(query, connection)
Dim ds As New DataSet()
If da.Fill(ds) Then
DDQuote.DataSource = ds.Tables(0)
DDQuote.DataTextField = "QuoteNumber"
DDQuote.DataBind()
'DDQuote.Items.Insert(0, New ListItem("Select", "Default value"))
End If
connection.Close()
Catch ex As Exception
'Console.WriteLine(ex.Message)
End Try
End Sub
AddquoteNumber button code
Protected Sub btnAQ_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAQ.Click
Dim connectionString As String = "Database=fabdb;" & "Data Source=localhost;" & "User Id=root;Password=pacvision"
Dim rowsEffected As Integer = 0
Dim Query As String = ""
Dim connection As New MySqlConnection(connectionString)
'Dim cmd As New MySqlCommand(Query, connection)
connection.Open()
Query = "insert into Quotes(query follows...................)
retriveDataToDropDown()
retriveDataToDataGrid()
connection.Close()
End Sub

View 8 Replies


Similar Messages:

Forms Data Controls :: Load Values Into DropDown

Feb 1, 2011

I have two Dropdownlist on my webform(DDWO,DDLI) on Page_load I am retreiving WONumber values into DDWO when i select WONumber and click on Button corresponding values of selected WONumber will be loaded into DDLI but i dont want button here, instead when i select value in DDWO(WONumber) corresponding values of selected WOnumber should be loaded into DDLI.On which event i have to write insted of button to load values on select of DDWO value. Following code to retreive values to DDWO,DDLI

[Code]....

View 10 Replies

Web Forms :: Load The QuoteNumber Database Column Values Into Dropdown?

Mar 2, 2010

How can i load the QuoteNumber database column values into dropdown list which is autogenerated column.I am able to generate the QuoteNumber value and same inserting into database simultaniously all the Quotenumber values should load into dropdown, these two should happen in one click button event.My QuoteNumber dropdown name is "DDQuote" Code for generating Quotenumer and same inserting into database.

Protected Sub btnAQ_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAQ.Click
Console.WriteLine(updateRecord("insert into quotes (PartNumber) values ('" + txtPart.Text + "')"))
retriveDataToDataGrid()
End Sub
Function updateRecord(ByVal query As String) As Integer
Try
Dim connectionString As String = "Database=fabdb;" & "Data Source=localhost;" & "User Id=root;Password=pacvision"
Dim rowsEffected As Integer = 0
Dim connection As New MySqlConnection(connectionString)
Dim cmd As New MySqlCommand(query, connection)
connection.Open()
rowsEffected = cmd.ExecuteNonQuery()
connection.Close()
Return rowsEffected
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Function

View 5 Replies

Forms Data Controls :: Load Dropdown Menus On Runtime With Values?

Sep 29, 2010

I am designing my own Customize Calendar for my webproject.Using Calendar Control of asp.net2.0 I want to add three dropdowns at the top to collect Hour, Minutes and Seconds.What I required to load dropdown menus on runtime with values:

View 1 Replies

Forms Data Controls :: Dropdown Won't Populate Values From Sql Database

Oct 6, 2010

Ive been strugglng with this one problem for a while now. I have an application as: SelectCommand="SELECT [CategoryID], [Name], [UserId] FROM [Categories] WHERE ([UserId] = @UserId) ORDER BY [Name]">
<SelectParameters>
<asp:QueryStringParameter Name="CategoryID" QueryStringField="ID" />
</SelectParameters> [code]....

the dropdown list control will populate values from the database but when i live those 2, it won't populate any value from the database. When i remove only the
<asp:QueryStringParameter Name="CategoryID" QueryStringField="ID" />
</SelectParameters>
and live ([UserId] = @UserId), i get the error : Must declare the scalar variable "@UserId".

View 2 Replies

Forms Data Controls :: Load Dropdown With Null Value?

Sep 27, 2010

For insertion, I have dropdown inside a form.

The dropdown is linked with sqldatasource which is retreiving distinct records from table.

In table there is no NULL value.

What I want to do that when user will access Insert page to insert record then like all textboxes, dropdown should also load with NULL value.

View 9 Replies

Forms Data Controls :: How To Load The Dropdown List In The Gridview

May 18, 2010

i would like to know how to load the dropdown list in the Gridview edit with the dropdown list values from the database

View 3 Replies

Forms Data Controls :: How To Load DropDown On The Basis Of UserProfile

Mar 4, 2010

I required to load dropdown with the section name on the basis of UserProfile when the page load anytime.

The dropdown is bounded by sqldatasource configured to TblSections.

TblSections with datafields sectionId(numeric) and Description.

There is another table Users with field sectionId and UProfile.

There is a gridview grvResult bounded by objecdatasource configured to TblFltReg.

TblFltReg has field Owner(numeric).

Actually Owner and SectionId are same.

I don't know how to do this task.

View 5 Replies

Forms Data Controls :: Dropdown Doesn't Load With The Relevant Data When Select A Value From The First

Jun 10, 2010

I am experimenting with 3 dropdowns bound to 3 different datasources. I want the contents in each dropdown depending on what is selected from the above dropdown and the datasource queries reflect this.

<asp:DropDownList ID="DropDownList_CostCentres" runat="server" Height="16px"
Width="138px" DataSourceID="CostCentreDataSource" DataTextField="CostCentre"
DataValueField="CostCentreID">
</asp:DropDownList>
<asp:SqlDataSource ID="CostCentreDataSource" runat="server"
ConnectionString="<%&#36; ConnectionStrings:corkABCConnectionString %>"
SelectCommand="SELECT [CostCentreID], [CostCentre] FROM [CostCentres]">
</asp:SqlDataSource>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Manager:" Font-Bold="True"></asp:Label>
<br />
<asp:DropDownList ID="DropDownList_Managers" runat="server" Height="16px"
Width="138px" DataSourceID="ManagerDataSource" DataTextField="EmployeeName"
DataValueField="EmployeeID">
</asp:DropDownList>
<asp:SqlDataSource ID="ManagerDataSource" runat="server"
ConnectionString="<%&#36; ConnectionStrings:corkABCConnectionString %>"
SelectCommand="SELECT [EmployeeID], [EmployeeName] FROM [Employees] WHERE ([CostCentre] = @CostCentre)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList_CostCentres" Name="CostCentre"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

However, the second dropdown does not load with the relevant data when I select a value from the first dropdown (stays blank). Must I still provide an event handler and how do I combine this with the sqldatasource?

View 6 Replies

Forms Data Controls :: Load Data From Sql Server To A Dropdown List?

Dec 6, 2010

i want my dropdown list or my list box, load data from my database .i use visual studio 2008 and sql server 2005.

View 3 Replies

Web Forms :: Record DropDown List Values As ID To The Database

Nov 11, 2010

i am using a list view to view, insert, update and delete my data for the admin page this admin page made for the news and we have categories for that so i need to use a drop down list for these categories and when the admin choose on of these categories records its value as an ID to the database.

[Code]....

View 8 Replies

Data Controls :: Get Value In Dropdown From Database / Show Other Value Which Is There In Dropdown

May 7, 2015

I want to display the selected value from gridview in a dropdownlist.Here I am not getting the Dropdown from Database as it contains two values.After getting the data user can modify the DDL and change the selection.The data type where the values are saved is declared as Bit.

<asp:Label ID="lblQuery" CssClass="labelbold" runat="server" Text="Query"></asp:Label>
<asp:TextBox ID="txtQuery" runat="server"></asp:TextBox>
<asp:Label ID="lblStatus" CssClass="labelbold" runat="server" Text="Active Status"></asp:Label>
<asp:DropDownList ID="ddlStatus" runat="server">
<asp:ListItem>--Select--</asp:ListItem>

[code]....

Till here it works fine how do I fill the dropdown from database.Eg Active text is coming from Database,so DDL should show Active along with Inactive value.

View 1 Replies

Forms Data Controls :: Getting The Selected Values From A Dropdown List

Jan 25, 2011

I have created a dynamic dropdownlist. I need to get the selected values from the dynamic list and store it my sql database.

View 5 Replies

Forms Data Controls :: Retrieve Multiple Values From Dropdown?

Feb 23, 2011

I'm populating a dropdown box bound to an sqldatasource. From the sqldatasource, I'm retrieving locationID,locationType and LocationName.

The locationName is displayed in the dropdown. The selected values is set to, "locationID'. Based on the 'LocationID' the user is directed to a new page.

However, I need to pass the "locationID" and also the "LocationTYpe" values for the selected Name, so the sure can be directed to a specific page..how do I get BOTH values, 'locationID' and 'LocationType' when the user selects 'Location NAme' from drop down.

View 4 Replies

Forms Data Controls :: Gridview Not Populating With Dropdown Values?

Oct 5, 2010

when testing my query in the grid configuration wizard it works fine, but when i run the page it does not.

first - i select values from my cascading drop down list then enter values for two textbox (dates). then when i hit the button to populate my grid nothing is return back.

[Code]....

View 9 Replies

Forms Data Controls :: How To Get The Foreign Key Values In DropDown List

Jun 12, 2010

I'm using objectDataSource and Formview. Currently I'm using a Text-Box to put the CategoryID.

I want to display the Category-Name instead of Category ID in Drop Down list.

View 4 Replies

Forms Data Controls :: Getting Dropdown List Values In Codebehind (c#)?

Jan 18, 2011

in my proj i have a grid view which consists of name and droppown list as shown below:

<asp:GridView ID="gvJobs" runat="server" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="False" OnRowDataBound="gvJob_RowDataBound" OnRowCommand="gvJobs_RowCommand" >
<Columns>
<asp:TemplateField HeaderText="Jobs" SortExpression="name" HeaderStyle-HorizontalAlign="Left">

[Code]....

when i click the dropdown list it is postbacking(since i made auto postback=true). on that time i am unable to get the selected value from dropdown list.

View 3 Replies

Forms Data Controls :: Dropdown Is Not Loading With Newly Added Values From DB?

Apr 1, 2010

In my asp.net page i have one dropdown and its vales are loading from db.

new values for the dropdown we can add using a popup also for the popup i am using this code

[Code]....

once the data is added then i am refreshing the parent page using javascript and reloading the dropdown using the below code . and values are from db.

[Code]....

here in AllUSersByRole i am getting the newly added value from the db after that i am binding the value to dropdown and the new added value is not showing all the other values are present.

View 2 Replies

Forms Data Controls :: How To Get The Textbox And Dropdown List Values In To Gridview

Jul 16, 2010

i have 4 text boxes and 2 dropdowns are there when ever i fill it all values should place in grid view., after entering of 5 or 6 records, i click on SAVE button then ,i want to save those values in to Data Base ,which are at Grid view.....

Example:

[code]...

View 4 Replies

Forms Data Controls :: Display Two SQL Column Values In One Dropdown List

Apr 16, 2010

Is it possible to display two column values from a SQL database in to one DDL? I have been trying to write a SQL query, where in I select two fields to be displayed in the DDL but when I run the application it only displays one. Not sure why. Here is my code below:

<asp:DropDownList ID="DropDownList8" runat="server"
DataTextField="LATA"
DataValueField="LATA"
onselectedindexchanged="DropDownList8_SelectedIndexChanged"
DataSourceID="SqlDataSource1">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%&#36; ConnectionStrings:Inventory_DBConnectionString %>"
SelectCommand="SELECT DISTINCT [LATA], [LATA Name] AS LATA_Name FROM [CA] WHERE ([SWITCH ID] = @SWITCH_ID)">
<SelectParameters>
<asp:QueryStringParameter Name="SWITCH_ID" QueryStringField="ddl1"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>

View 3 Replies

Forms Data Controls :: Unique Values In Dropdown List At Runtime?

Oct 4, 2010

In given code finally I want to populate unique values at runtime in 2 drop downlist.

protected void Page_Load(object sender, EventArgs e)
{
vidDocument.Load(Server.MapPath("~/CurrentStatus.xml"));
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ExpiresAbsolute = DateTime.Now.AddMonths(-1);

[Code]....

View 2 Replies

JQuery Set Dropdown Values On Button Click?

Jan 17, 2011

I have a dropdown list and a button. When you click the button it will set all the dropdowns to a value using JQuery. The drop down is inside a div with a unique id. Is there any way I can get JQuery to set a drop down list value that is in a div without giving it a div class or id? I've attached the html, its just three drop downs each one inside a div class.

View 1 Replies

Forms Data Controls :: Assign Values To SqlDataSource Parameter From Dropdown List In InsertItemTemplate

Oct 29, 2010

I have a Detailsview grid with an SqlDatasource, this DVG is only going to be used to insert records. The primary purpose of the DS is to populate a DDL control in the insertItem Template that I created my code is this:

[Code]....

The DDL control populates correctly, but when I try to modify the INSERTCommand property in my DS, I try to assign the value to my parameters "TesterID" and "TesterDate" but the only options for controls to pick from, is the DGV but not the DDL in it. I assume it has to do with the InsertItem template but even if I reset it I still cannot pick the textbox as a control that would give the value to my parameters.

I did find a workaroun by build a public method and calling it in the onclick event of the insert button but looks like I have to create another connection to the database which to me seems unnecessary since I already have a DS and everything. how can I do this without having to use my method. here is my method just in case.

[Code]....

View 3 Replies

Forms Data Controls :: Create A Dropdown List That Concatenates Two Values In The Display Field?

Feb 10, 2010

I have a table that has 3 fields (Individual-Id, LastName, and FirstName). I want to create a drop down table that displays both the FirstName and the LastName (example: Smith, John). The field Individual-Id is the 'value' field.

View 4 Replies

Forms Data Controls :: Trying To Generate A Grid View From Database, In One Of My Database Columns The Values Are 'y' And 'N'?

Jan 8, 2010

I am trying to generate a Grid view from database, in one of my database columns the values are 'y' and 'N'. and i need to show this values in a check box .I tried to keep a check box in item template and tried to bind it, but could get much success.

[Code]....

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved