HighTechTalks DotNet Forums  

fill two droplist

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss fill two droplist in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Frank Dulk
 
Posts: n/a

Default fill two droplist - 05-24-2006 , 07:46 PM






As I do to fill out two droplist of different tables in the event open of
the webforms.

I get to fill out one, but when I try two says that cannot open another
connection.



Reply With Quote
  #2  
Old   
Gaurav Vaish \(EduJini.IN\)
 
Posts: n/a

Default Re: fill two droplist - 05-25-2006 , 12:20 AM






Can you provide some more details....
Is there any exception? The stacktrace and, preferably also, the code.

--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------


"Frank Dulk" <fdulk (AT) bol (DOT) com.br> wrote

Quote:
As I do to fill out two droplist of different tables in the event open of
the webforms.

I get to fill out one, but when I try two says that cannot open another
connection.




Reply With Quote
  #3  
Old   
Frank Dulk
 
Posts: n/a

Default Re: fill two droplist - 05-25-2006 , 09:11 PM



That is the code that I am sweating for filling out the dropdownlist1 with
the records of the table1.
How do I do to fill out other dropdownlist2 with the records of another
table2?

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

If Not IsPostBack Then

Dim strSql As String

Dim conexao As OleDbConnection

Dim dscmd As OleDbDataAdapter

Dim ds As DataSet

conexao = New OleDbConnection("provider=microsoft.jet.oledb.4.0; data
source=C:\Inetpub\wwwroot\Database_acesso1\talao.m db;")

conexao.Open()

Try

strSql = "select distinct tplt_desc from TblTipoLente order by tplt_desc"

dscmd = New OleDbDataAdapter(strSql, conexao)

ds = New DataSet

dscmd.Fill(ds, "TblTipoLente")

Me.DropCategorias.DataTextField = "tplt_desc"

Me.DropCategorias.DataValueField = "tplt_desc"

Me.DropCategorias.DataSource = ds.Tables("TblTipoLente").DefaultView

Me.DropCategorias.DataBind()

Me.DropCategorias.Items.Insert(0, New ListItem("Selecione seu tipo de
lente...", ""))

Finally

conexao.Close()

End Try

End If

End Sub

End Class




"Gaurav Vaish (EduJini.IN)" <gaurav.vaish.nospam (AT) nospam (DOT) gmail.com> escreveu
na mensagem news:ef950r7fGHA.1520 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
Quote:
Can you provide some more details....
Is there any exception? The stacktrace and, preferably also, the code.

--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------


"Frank Dulk" <fdulk (AT) bol (DOT) com.br> wrote in message
news:OR0VdS5fGHA.3456 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
As I do to fill out two droplist of different tables in the event open of
the webforms.

I get to fill out one, but when I try two says that cannot open another
connection.






Reply With Quote
  #4  
Old   
Gaurav Vaish \(EduJini.IN\)
 
Posts: n/a

Default Re: fill two droplist - 05-25-2006 , 10:49 PM



Quote:
That is the code that I am sweating for filling out the dropdownlist1 with
the records of the table1.
How do I do to fill out other dropdownlist2 with the records of another
table2?
Exactly the same way as you did for ddl1.
You need to have a new instance of OldDbConnection. The same connection will
not work.



--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------




Reply With Quote
  #5  
Old   
AT
 
Posts: n/a

Default Re: fill two droplist - 05-26-2006 , 08:53 AM



I've been using a tool called the DataSet Toolkit to handle Fills and
Updates of multiple DataTables like you're doing. It will manage your
connection for you so you don't need to worry about creating a new one,
and it will even write the SQL to fill your table at runtime, so you
won't need to do that either. You can find it here:

http://www.hydrussoftware.com

John B.
http://johnsbraindump.blogspot.com


Reply With Quote
  #6  
Old   
Frank Dulk
 
Posts: n/a

Default Re: fill two droplist - 05-26-2006 , 04:26 PM



ok Gaurav Vaish, will test in your way.
Thank you very much John B. will also see that program.

Does he/she/you have how in the dropdownlist to show the name and does keep
the id in the table, as if it was two columns?


<jmbledsoe (AT) gmail (DOT) com> escreveu na mensagem
news:1148651580.333959.321070 (AT) i40g2000cwc (DOT) googlegroups.com...
Quote:
I've been using a tool called the DataSet Toolkit to handle Fills and
Updates of multiple DataTables like you're doing. It will manage your
connection for you so you don't need to worry about creating a new one,
and it will even write the SQL to fill your table at runtime, so you
won't need to do that either. You can find it here:

http://www.hydrussoftware.com

John B.
http://johnsbraindump.blogspot.com




Reply With Quote
  #7  
Old   
Gaurav Vaish \(EduJini.IN\)
 
Posts: n/a

Default Re: fill two droplist - 05-27-2006 , 08:42 AM



Hi Frank,

Quote:
Does he/she/you have how in the dropdownlist
to show the name and does keep the id in the table, as if it was two
columns?
Probably couldn't understand your question.
Here's my understanding:

Table1: id, name
DropDownList:
DisplayText => name
Value => id

eg:

<option value='1'>Gaurav Vaish</option>
where 1 is the value of the field id and "Gaurav Vaish" is the value of
the field name.

That should be trivial.
ddl.DataTextField = "name";
ddl.DataValueField = "id";


--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------




Reply With Quote
  #8  
Old   
Frank Dulk
 
Posts: n/a

Default Re: fill two droplist - 05-27-2006 , 01:25 PM



Exactly that.
Thank you very much.

would have as in a text box to type +1 or -1 or +74 or...
but would have to impose a limit up to +170 or -170

But has to have that mask.+ or -


"Gaurav Vaish (EduJini.IN)" <gaurav.vaish.nospam (AT) nospam (DOT) gmail.com> escreveu
na mensagem news:%23vHrzNZgGHA.4932 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
Quote:
Hi Frank,

Does he/she/you have how in the dropdownlist
to show the name and does keep the id in the table, as if it was two
columns?

Probably couldn't understand your question.
Here's my understanding:

Table1: id, name
DropDownList:
DisplayText => name
Value => id

eg:

option value='1'>Gaurav Vaish</option
where 1 is the value of the field id and "Gaurav Vaish" is the value of
the field name.

That should be trivial.
ddl.DataTextField = "name";
ddl.DataValueField = "id";


--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
-------------------





Reply With Quote
  #9  
Old   
Gaurav Vaish \(EduJini.IN\)
 
Posts: n/a

Default Re: fill two droplist - 05-27-2006 , 09:22 PM



Quote:
would have as in a text box to type +1 or -1 or +74 or...
but would have to impose a limit up to +170 or -170
Use javascript to validate the value.
onchange (client side) event.

Quote:
But has to have that mask.+ or -
That should be trivial.
You would need even smarter / faster event -- onkeypress, again the client
side.


--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
http://webservices.edujini.in
-------------------




Reply With Quote
  #10  
Old   
Frank Dulk
 
Posts: n/a

Default Re: fill two droplist - 05-28-2006 , 12:21 PM



Would be able to for an example?


"Gaurav Vaish (EduJini.IN)" <gaurav.vaish.nospam (AT) nospam (DOT) gmail.com> escreveu
na mensagem news:u1kAp2fgGHA.1264 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Quote:
would have as in a text box to type +1 or -1 or +74 or...
but would have to impose a limit up to +170 or -170

Use javascript to validate the value.
onchange (client side) event.

But has to have that mask.+ or -

That should be trivial.
You would need even smarter / faster event -- onkeypress, again the client
side.


--
Happy Hacking,
Gaurav Vaish
http://www.mastergaurav.org
http://www.edujini.in
http://webservices.edujini.in
-------------------





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.