fill two droplist

Discussion in 'ASP .Net Web Services' started by Frank Dulk, May 25, 2006.

  1. Frank Dulk

    Frank Dulk Guest

    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.
     
    Frank Dulk, May 25, 2006
    #1
    1. Advertising

  2. Frank Dulk

    Frank Dulk Guest

    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.mdb;")

    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)" <> escreveu
    na mensagem news:...
    > 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" <> wrote in message
    > news:...
    >> 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.
    >>

    >
    >
     
    Frank Dulk, May 26, 2006
    #2
    1. Advertising

  3. Frank Dulk

    Guest

    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
     
    , May 26, 2006
    #3
  4. Frank Dulk

    Frank Dulk Guest

    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?


    <> escreveu na mensagem
    news:...
    > 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
    >
     
    Frank Dulk, May 26, 2006
    #4
  5. Frank Dulk

    Frank Dulk Guest

    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)" <> escreveu
    na mensagem news:%...
    > 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
    > -------------------
    >
    >
     
    Frank Dulk, May 27, 2006
    #5
  6. Frank Dulk

    Frank Dulk Guest

    Would be able to for an example?


    "Gaurav Vaish (EduJini.IN)" <> escreveu
    na mensagem news:...
    >> 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
    > -------------------
    >
    >
     
    Frank Dulk, May 28, 2006
    #6
  7. Frank Dulk

    Frank Dulk Guest

    Everything well, I am going trying to seek something that helps me.

    I am in I await .
    Thank you.

    "Gaurav Vaish (EduJini.IN)" <> escreveu
    na mensagem news:%...
    >> Would be able to for an example?

    >
    > Yes... u just need to be patient for a while.. am travelling.
    > It's actually simple... but will give u an example.
    >
    >
    > --
    > Happy Hacking,
    > Gaurav Vaish
    > http://www.mastergaurav.org
    > http://webservices.edujini.in
    > -------------------
    >
    >
     
    Frank Dulk, May 30, 2006
    #7
  8. Frank Dulk

    Frank Dulk Guest

    Does excuse, but where do I glue that code?
    My knowledge is very limited.


    "Gaurav Vaish (www.EduJini.IN)" <>
    escreveu na mensagem news:...
    > Frank,
    >
    > Here's what you can start with...
    >
    > <input id='box1' type='text' onchange='validateValue(this)'
    > onkeypress='return checkKey(this, event)' ... />
    >
    > JavaScript initialization of the text box (for last validated value):
    > var box1 = getElementById('box1');
    > box1.validValue = -1; //Initial value
    >
    > Javascript functions:
    >
    > function checkKey(sender, e)
    > {
    > // Use this if you want to validate each key-press
    > // Return true if you accept the character typed, false if you
    > don't want to be accepted
    > return true;
    > }
    >
    > function validateValue(tb)
    > {
    > var value = tb.value;
    > var setVal = tb.validValue; // The last stored valid value
    > try
    > {
    > var intval = int.Parse(value);
    > if(intval >= -170 && intval <= 170)
    > {
    > setVal = intval;
    > }
    > } catch { }
    > tb.validValue = setVal; // This is for internal use
    > tb.value = setVal; // This is what keeps changing as
    > user types
    > }
    >
    > For exact and advanved javascript, you may like to go to flashy places
    > like www.dynamicdrive.com etc.
    >
    > --
    > Happy Hacking,
    > Gaurav Vaish
    > http://www.mastergaurav.org
    > http://webservices.edujini.in
    > -------------------
    >
    >
    > "Gaurav Vaish (EduJini.IN)" <> wrote
    > in message news:%...
    >>> Would be able to for an example?

    >>
    >> Yes... u just need to be patient for a while.. am travelling.
    >> It's actually simple... but will give u an example.
    >>
    >>
    >> --
    >> Happy Hacking,
    >> Gaurav Vaish
    >> http://www.mastergaurav.org
    >> http://webservices.edujini.in
    >> -------------------
    >>
    >>

    >
    >
     
    Frank Dulk, May 31, 2006
    #8
  9. Frank Dulk

    Frank Dulk Guest

    I tried to copy and to glue in the it paginates for testing and gave
    mistake.
    Excuse, but I didn't get.

    "Gaurav Vaish (www.EduJini.IN)" <>
    escreveu na mensagem news:%23LYL$...
    >> Does excuse, but where do I glue that code?
    >> My knowledge is very limited.

    >
    > He he. :)
    > This code can be added directly in the ASPX page.
    > Where you need the ID, use it from the code-behind since it is there that
    > you have access to the ClientID.
    >
    >
    > --
    > Happy Hacking,
    > Gaurav Vaish
    > http://www.mastergaurav.org
    > http://webservices.edujini.in
    > -------------------
    >
    >
     
    Frank Dulk, Jun 1, 2006
    #9
  10. Frank Dulk

    Frank Dulk Guest

    I am going of the a glance yes. I really need.

    But if wants me it orders a small page example I am thanked.


    "Gaurav Vaish (www.EduJini.IN)" <>
    escreveu na mensagem news:...
    > Hi Frank,
    >
    >> Excuse, but I didn't get.

    >
    > Do a thorough study on HTML elements and events.
    >
    > If you still don't get, mail me (my email is in From header, remove the
    > "nospam" parts)... but do study thoroughly for at least a couple of days.
    >
    > That would help you in the long run as well. It's actually very simple
    > to study than to write a whole specific code for it. :)
    >
    >
    > --
    > Happy Hacking,
    > Gaurav Vaish
    > http://www.mastergaurav.org
    > http://webservices.edujini.in
    > -------------------
    >
    >
     
    Frank Dulk, Jun 1, 2006
    #10
  11. Frank Dulk

    Frank Dulk Guest

    I don't have idea of how to work with scripts. A small sample page in vb.net
    would be an initial point.


    "Gaurav Vaish (www.EduJini.IN)" <>
    escreveu na mensagem news:...
    > Hi Frank,
    >
    >> Excuse, but I didn't get.

    >
    > Do a thorough study on HTML elements and events.
    >
    > If you still don't get, mail me (my email is in From header, remove the
    > "nospam" parts)... but do study thoroughly for at least a couple of days.
    >
    > That would help you in the long run as well. It's actually very simple
    > to study than to write a whole specific code for it. :)
    >
    >
    > --
    > Happy Hacking,
    > Gaurav Vaish
    > http://www.mastergaurav.org
    > http://webservices.edujini.in
    > -------------------
    >
    >
     
    Frank Dulk, Jun 1, 2006
    #11
  12. Frank Dulk

    Frank Dulk Guest

    thank you, I will be in I await .
    You are a legal boy.


    "Gaurav Vaish (www.EduJini.IN)" <>
    escreveu na mensagem news:...
    > >I don't have idea of how to work with scripts. A small sample page in
    > >vb.net would be an initial point.

    >
    > I'll try to see if I can manage some time out for the help for you.
    >
    >
    > --
    > Happy Hacking,
    > Gaurav Vaish | http://www.mastergaurav.org
    > http://www.edujini.in | http://webservices.edujini.in
    > -------------------
    >
    >
     
    Frank Dulk, Jun 4, 2006
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Meir Rotfleisch

    Newbie Question about DropList and Page Load

    Meir Rotfleisch, Nov 2, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    342
    Thomas F.B.
    Nov 2, 2003
  2. Lasse Edsvik

    Filelist -> Droplist?

    Lasse Edsvik, Oct 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    421
    =?Utf-8?B?c3Jpbmk=?=
    Oct 4, 2004
  3. TJS
    Replies:
    4
    Views:
    2,965
  4. TJS
    Replies:
    2
    Views:
    699
  5. TJS
    Replies:
    5
    Views:
    2,089
    =?Utf-8?B?amZsZWVzb24=?=
    Mar 13, 2005
Loading...

Share This Page