Asp.net - Pass Data From Dropdownlist?

Apr 28, 2011

I have been trying to pass selected data from two dropdownlist (page1.aspx) to (page2.aspx) I am not having any luck as it seems the data is not being passed when selected. Please help, this doesn't seem that difficult, but I can not get it work. On (page2.aspx) the data from the dropdownlists will be passed to a stored procedure and all results will be in a gridview.

Here is my code:

Page1.aspx
<asp:DropDownList ID="ddlState" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="ST_Code" DataValueField="ST_Code" />

[code].....

View 1 Replies


ADVERTISEMENT

Pass Data To Dialog - Manipulate And Pass Back?

Jan 15, 2010

Just started VB programming this week and have found a wealth of information about what I'm trying to do. Problem is, some of it is more complete than others.Here's what I'm trying to do:In Form1 (my main form), I want to instantiate a class that contains a couple of properties (speed setpoint and position setpoint). When I click a button, I want to pass this data to Form2 and populate two textboxes on Form2 with the properties of this object. I want to manipulate the property values on Form2 and click an OK button which closes the dialog and returns the manipulated data, updating the property values of the object. Here's the algorithm I'm following:1) On Form1, instantiate the class2) On Form1's "Pass Data" button click event handler, instantiate a Form2 object and invoke the ShowDialog method, passing the object as a parameter.

3) On Form2, overload the ShowDialog method to accept the object as a parameter and modify the method so that it returns the manipulated class data.4) On Form2, in the ShowDialog method, populate the textboxes with the class data that was passed in.Here's where I get stuck. If I press the OK button on Form2 (DialogResult.OK), it returns me to Form1, but what hook do I have in Form1 to receive the manipulated class data that the ShowDialog method is returning?Here's an example of what I'm thinking about:

Code:
Public Class Form1
Dim clsController1 As New MotionController

[code].....

I'm sure it's probably a very elementary question, but every explanation I've found seems to be incomplete.

View 2 Replies

Browser Compatible Code To Disable A Dropdownlist When Another Dropdownlist Is Clicked Or A Checkbox Is Checked?

May 26, 2011

I have a window having 2 dropdowmlists(schemename-SN and propertyno-PN) , one chkbox ,one "VIEW" button.SN has options "all" with value=0 and many other options with respctive values.Now,i want the code should behaves as follows:

1.0n window onload, SN must b visible bt PN nt.

2.if i select SN other thn All...the PN shud b visible and if i select "All" ,PN hides.

3.when check box is checked- PN hides,and if it is unchecked- PN visible..

Important:-This whole ddl n chk box are in updatable panel,button is nt in that.I want a browser compatible code so javascript can't b used directly(cz they give problem in mozzila and chrome).Right now, i have done this JavaScript and its is working fine.

function window.onload()
{
DisableProperty();
}

[code]....

but this code is not browser compatible.here onload,onkeyup and onclick functions are used , but they dont work in other browsers except internet explorer.

View 1 Replies

Fetching Data From Databinded DropDownList?

Jul 19, 2010

I Have a data table like this:

UserID Username Password Email

an a dropdownlist that is binded to this table

DisplayMember is Username
Value member is UserID

now how can I get forexample Email when an Item is selected?

View 3 Replies

Asp.net - Binding DropDownList To Detailsview Without Data Source?

Feb 23, 2012

Im trying to do bind a dropdown list to a details view but keep getting an error about the dropdown list ID field:

<asp:TemplateField HeaderText="Approval">
<ItemTemplate>
<asp:DropDownList ID="Approved" runat="server" DataValueField="Approved" SelectedValue='<%#Bind("Approved") %>'>
<asp:ListItem Text="Approved" Value="Approved" />

[code]....

The error message as follows:

'Approved' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value

What is the proper way to attach the value of the dropdownlist to my object so that it can be properly created in the database? Most of my searches keep telling me how to bind a dropdownlist to an object data source, but that is not what I need to do. This is a basic drop down list of 2 items that will never change.

View 1 Replies

Asp.net - Refreshing DropdownList Data, After A New Item Has Been Selected

May 10, 2011

I have two dropdownlist, one is State and one is City. When a State is selected, the City dropdownlist becomes populated. At that point you can select a city, however if you select a city and go back and select a different state, the city dropdownlist is populated by the cities for both states. How do I get it clear the cities for the first state?

Here is the code behind

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub

[Code].....

View 1 Replies

Data-bound Dropdownlist That Permits Manual Entry Also?

Aug 16, 2011

I am not a .net programmer but I can write bits and pieces that I need, however, I have been having trouble working out the best way to achieve something for a website I'm altering.I basically need to have a drop down list which is bound to a certain SQL call (already in place) but I also need the ability to manually type into the drop down list for items that do not exist. These items do not need to be entered into the SQL (I can handle the additional data separately) but I cannot find a way to type inside a drop down list while it is bound to a datasource.Some entries in the datasource (SQL table) are used for one thing, but then a text string needs to be entered for optional entries which do not exist within this SQL table.

Does anyone know how I can achieve this or maybe another similar control can be used that offers this kind of functionality?**Update to be more clear:I need this at runtime. For instance, I do not need this to be within code I actually need the control to accept user input when someone is on the webpate.Imagine a shopping list and all the items are within the drop down list then the user wants to add another item to the shopping list so they just type it into the drop down box and submit the page and its value will be used instead of an existing item.

View 1 Replies

VS 2005 Data Deleted But Dropdownlist Of The Combobox Is Not Updated?

Sep 1, 2009

i did this code to delete data from the database and update the dropdownlist of the combobox(i.e,remove the deleted data from the dropdownlist of the combobox):

Private Sub Delete_Btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Delete_Btn.Click
Dialog1.ShowDialog()

[Code]....

View 1 Replies

Reload Page Data Based On Dynamic DropdownList Selected Value

Oct 26, 2011

I have a bit of a tricky scenario. It consists of some partial problems for which I have individually found solutions, but I couldn't find anything that makes it all work together smoothly.

-Upon selecting an item in a datagrid, a new page loads with the details regarding that entity.
-The entity represents a product that can have any amount of variants (such as a t-shirt's color or size)
-I dynamically add dropdownlists to this detail-page that represent these variants (there can be any amount of variants, and each variant can have any amount of different values, each value or combination or values from different variants representing a unique product entity)
-Upon selecting a different variant in a dropdown, a delegate is called that will change the session variable to the productId associated with the selected variant and a postback is fired that will reload the page with new data based on this productId

The problem: the postback is fired BEFORE the dropdownlist's (OnSelectedIndexChanged) delegate is called. Since this delegate defines the productId in the session, the new to-be-used productId isn't known at the time of postback.

Result: loading the correct data in the page is always delayed by one postback. Each time I change the selected index of any of the dropdowns, the page is loaded with data based on the session variable that the PREVIOUS OnSelectedIndexChanged delegate of the dropdown set.

I have a LoadData() method that sets the values of all textboxes, fields, labels etc. based on the productId stored in the current session. This method is called on Page_Load.
Private Property CurrentProduct As Product
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
LoadData()
[Code] .....

It seems that I haven't been completely clear on what does and doesn't apply to this scenario regarding Page Lifecycle.

1) My dropdownlists are added dynamically, which works fine on the first page_load.
2) The content of the dropdownlists is defined by what entity's details i'm loading on the page.
3) What entity's details I'm loading on the page is at first(not-postback) defined by the product I selected in a gridview in the previous page.
4) At postback, this entity is based on a sessionvariable containing the id of the entity.
5) This session variable is defined by what item in the dropdownlist I select.
6) This dropdownlist dissapears after postback since it's not defined on the page, but dynamically. So is the event.

So my guess would go towards some clientside script that stored the selected value before postback, but then I would be clueless on how to get that variable to the server since the logic that retrieves the entity is in the business logic layer which is far away from this page..

View 3 Replies

Asp.net - Populate DropdownList Based Upon Other DropDownList VB?

Jun 1, 2009

I have found a couple of examples on the internet to do this but really struggling to get it working in VB. (Tried a converter but had mixed results) I need the selection options of a Dropdownlist to be populated based upon the differing values in the first dropdown list.

Can anyone help with a releativley simple example in VB? Not fussed if the values are "hard coded" in the script. Or a SQL bit that pulls the data from a table

View 3 Replies

VS 2005 Checkbox In My Application - Fetch The Data From The Database And Add It To The Dropdownlist Of The Combobox

Aug 31, 2009

I have a checkbox in my application,when the checkbox is checked then i want to fetch the data from the database and add it to the dropdownlist of the combobox.Again when the checkbox is unchecked then i want to ramove all the data from the dropdownlist of the combobox.

I did this

Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
con = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=Etech.mdb")

[CODE]...

When the checkbox is checked then the data is added from the database to the dropdownlist of the combobox but when i uncheck it then the data is not removed from the dropdownlist of the combobox. In the above code i think i need to add an else condition to remove the data from the dropdownlist of the combobox and make it empty when the checkbox is unchecked.......but i cant give the proper else condition in the above code.

View 7 Replies

Pass Data From Datagridview To Textbox And Append New Data To The Next Line?

Sep 13, 2010

I am trying to click on certain rows in a datagridview and have the information in the rows sent to a textbox. It does not append each row to the textbox though, which is what I want it to do. it just replaces it with the row I click on. What's wrong with my code. I have tried cell click too.

Private Sub dgProducts_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgProducts.Click
Dim i As Integer

[Code]....

View 2 Replies

Pass Data From VB 2008 Project To Data Fields Set In Word?

Dec 10, 2009

I�d like to pass data from my VB 2008 project to data fields set in Word. Can it be done and if so

View 10 Replies

Pass Data Between VB6 App And .Net App?

Jan 27, 2012

I need to pass data between a vb6 app and a .net app. This data will either be written or read every second. It is about 30 fields. Both apps reside on the same machine. I am currently passing this data via the registry and it works great but it makes me a little nervous. I would do it with a text file but I am worried about data loss.

View 4 Replies

Populate Dropdownlist From Another Dropdownlist?

Jan 15, 2012

I'm trying to write a program that selects an item (Area Code) from a combobox and this list gets the city that was associated with this area code (another comnbobox list)

View 1 Replies

Pass Data Between Forms?

Oct 3, 2011

Is this way a "right" way to pass data between two forms?[code]...

View 1 Replies

Pass Data Between WPF Windows?

Apr 13, 2011

I have some code that works in winforms, but not in WPF apparently, the code is as follows: This is set globally:

Private Property avar As Object
Public main As MainWindow
Public charchoice As Char

And then in the Window Loaded sub, this is placed:

charchoice = main.charchoice

Thing is, the next window doesn't pick up this variable, so how can I make it recognise and use it?

View 1 Replies

Pass Data From Other Class?

Apr 7, 2011

I'm still trying to develop p2p chat application from this thread. I have 2 applications, server and client. A client has: Form1.vb, BB_Client.vb, and RTS_SocketClient.vb. Dataflow is Form1 creates new object of BB_Client, BB_Client calls RTS_SocketClient.[code]...

View 7 Replies

Pass Data Out Of An Object?

Dec 17, 2010

I have this [code]...

1. Create a global SQL instance and call .Write from within .ReadData

2. Create a new SQL instance within .ReadData and call .Write

3. Pass the data back to the code above and call .Write from the main code i.e. [code]...

View 1 Replies

Pass Data To A Message Box?

Nov 19, 2009

I have a form for end user (EU) to search for a certain code to check if it is an active code or not, i have the search bit working but i want to be able to have a message box saying "the code (code) is an active (product) code!"

So far i have:
Sub UpdateGrid(ByVal sqlStr As String)
Dim var As String

[code].....

View 1 Replies

Pass Data To Different Application?

Feb 3, 2009

I'm sure this is possible but I've got no clue of what I'm looking for to even start to learn this. Basically I want to create a form that can load data from one software application and feed it to another.

Is it possible to change settings in other forms by another piece of software like if there was a flag = True and I wanted to change it to flag = False or instead of loading Dim processorID As String = String.Empty I can input Dim processorID As String = 1234

View 8 Replies

Trying To Pass Data Between Form

Mar 10, 2010

trynig to pass data between form in first form [code]the problem is when i select "Yes" next form is not showing .i tried directly to run the last form. but its not added in the startup form list.i am getting error form2 is an type under windowsapplication1 and cannot be used as expression in application design.vb.

View 2 Replies

Collections - Pass Data To ActiveX.exe?

May 17, 2010

I've created a MAPI Wrapper in VB6 and compiled it as an ActiveX.exe so I can use it in my VB.NET project. The project is a windows service that takes data from a webservice passes data to activex.exe and it creates public folder records in exchange 2003. I was wondering if anyone know how I could pass a collection to my activex.exe?

View 1 Replies

How To Pass List (Of ) To Data Layer Of App

Jul 25, 2011

I've never used a List(Of) before and I'm not sure how to pass it to the Data Layer of my application. The ColResCategory is a property within the Business Layer (See below) and it needs to be passed to the Data Layer. ReplaceResCategory (See 2nd Code view) is another class file within my Business Layer and the ColResCategory references it.

Public Property ColResCategory() As List(Of ReplaceResCategory)
Get
If IsNothing(mColResCategory) Then
mColResCategory = New List(Of ReplaceResCategory)
End If
Return mColResCategory
[Code] .....

View 5 Replies

How To Pass Reference Data To New Form

Dec 5, 2011

I need to pass a reference of a class instance to a new form; the newform obtains data from the user to be added to the class instance. How might I do this? Is there a way to pass it as a parameter via the ShowDialog call?

View 2 Replies

How To Pass Structure Into A Data Layer

Feb 19, 2011

I'm creating a Data Layer for a Web Application and in one of my functions, I need to pass in a Structure full of Customer info. This Data Layer is essentially a DLL. My problem is that I'm not sure how to do this.Below is my code and what I want to do.

[Code]...

View 5 Replies

Pass Data Between Two Winform Applications?

Feb 14, 2011

I have two VB projects in one VS2010 solution. The first program brings in about 60 integers every few seconds from my PC's serial port. The second program, published via Click-Once and running on my customer's PC, needs to see that new data every two to five seconds.

Is there a simple and reliable way to accomplish this, staying with VB? WCF is way over my head.

View 11 Replies

Pass Data Between Webpage And VB Application?

Oct 17, 2011

I am developing an application for internal use in our company. The purpose of this application is for document imaging. What we are wanting to do is print a barcode label to attach to documents so that when they are scanned in a piece of software such as vfiler will be able to read the barcodes and know how to file them.The main focus is our ERP system which is web based (PHP). We are wanting to modify the code to allow the user to print the barcode label immediately once they enter an order or PO. I have access to the source code for the ERP web pages. I don't know of any way to make a web page print to a printer without displaying the printer select dialog. So, I decided that I wanted to try and create a VB application that would do the printing of the barcodes. This would allow me to bypass the the printer select dialog.

Now for the question. Is there any way to have a web page (PHP) running on the server call a VB app to perform a task? So, if I had a button on the webpage and the user clicked it, that button would somehow send the pertinent information (Order number) to the VB app and the VB app would print the barcode. The VB app will always be running on the machine. The label printers will be Zebra USB label printers on each person's machine.

View 2 Replies

Pass Data From VB To Microsoft Access?

Mar 14, 2009

Remove a record from a Access database using a VB?I have created a small database in Access,then using VB 2008 Express Edition, created a link between Vb form and Access When I try and Add then Save a record, the information is not in the database.But I can't remember how to:-*Add a record*Save the record*Edit an existing record*Find a record in the databas of interest, is it possible for the add button to be clicked when the VB form loads, and if so how do I achieve this

View 2 Replies

Pass Data From View To UserControl In ASP.NET MVC?

Mar 24, 2010

Say I want to do the simplest of the data passing as follows [code]...

What I want to do is to pass the variable i as the parameter to the UserControl so that it displays the number inside a, say, bordered div.

View 2 Replies







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