|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
fill two droplistAs 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. Can you provide some more details....
Is there any exception? The stacktrace and, preferably also, the code. Show quote "Frank Dulk" <fd***@bol.com.br> wrote in message news:OR0VdS5fGHA.3456@TK2MSFTNGP05.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. > 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 Show quote "Gaurav Vaish (EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> escreveu na mensagem news:ef950r7fGHA.1520@TK2MSFTNGP03.phx.gbl... > 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" <fd***@bol.com.br> wrote in message > news:OR0VdS5fGHA.3456@TK2MSFTNGP05.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. >> > > > That is the code that I am sweating for filling out the dropdownlist1 with Exactly the same way as you did for ddl1.> the records of the table1. > How do I do to fill out other dropdownlist2 with the records of another > table2? You need to have a new instance of OldDbConnection. The same connection will not work. 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 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? <jmbled***@gmail.com> escreveu na mensagem Show quote news:1148651580.333959.321070@i40g2000cwc.googlegroups.com... > 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 > Hi Frank,
> Does he/she/you have how in the dropdownlist Probably couldn't understand your question.> to show the name and does keep the id in the table, as if it was two > columns? 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"; 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 - Show quote "Gaurav Vaish (EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> escreveu na mensagem news:%23vHrzNZgGHA.4932@TK2MSFTNGP03.phx.gbl... > 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 > ------------------- > > > would have as in a text box to type +1 or -1 or +74 or... Use javascript to validate the value.> but would have to impose a limit up to +170 or -170 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 ------------------- Would be able to for an example?
Show quote "Gaurav Vaish (EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> escreveu na mensagem news:u1kAp2fgGHA.1264@TK2MSFTNGP05.phx.gbl... >> 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 > ------------------- > > > 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 ------------------- Everything well, I am going trying to seek something that helps me.
I am in I await . Thank you. Show quote "Gaurav Vaish (EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> escreveu na mensagem news:%23VkdatwgGHA.3496@TK2MSFTNGP02.phx.gbl... >> 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,
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. -- Show quoteHappy Hacking, Gaurav Vaish http://www.mastergaurav.org http://webservices.edujini.in ------------------- "Gaurav Vaish (EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> wrote in message news:%23VkdatwgGHA.3496@TK2MSFTNGP02.phx.gbl... >> 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 > ------------------- > > Does excuse, but where do I glue that code?
My knowledge is very limited. Show quote "Gaurav Vaish (www.EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> escreveu na mensagem news:Of3SYuAhGHA.1520@TK2MSFTNGP03.phx.gbl... > 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)" <gaurav.vaish.nospam@nospam.gmail.com> wrote > in message news:%23VkdatwgGHA.3496@TK2MSFTNGP02.phx.gbl... >>> 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 >> ------------------- >> >> > > > Does excuse, but where do I glue that code? He he. :-)> My knowledge is very limited. 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 ------------------- I tried to copy and to glue in the it paginates for testing and gave
mistake. Excuse, but I didn't get. Show quote "Gaurav Vaish (www.EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> escreveu na mensagem news:%23LYL$iFhGHA.4708@TK2MSFTNGP04.phx.gbl... >> 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 > ------------------- > > 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 ------------------- I am going of the a glance yes. I really need.
But if wants me it orders a small page example I am thanked. Show quote "Gaurav Vaish (www.EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> escreveu na mensagem news:u77CqKbhGHA.4404@TK2MSFTNGP05.phx.gbl... > 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 > ------------------- > > I don't have idea of how to work with scripts. A small sample page in vb.net
would be an initial point. Show quote "Gaurav Vaish (www.EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> escreveu na mensagem news:u77CqKbhGHA.4404@TK2MSFTNGP05.phx.gbl... > 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 > ------------------- > > >I don't have idea of how to work with scripts. A small sample page in I'll try to see if I can manage some time out for the help for you.>vb.net would be an initial point. -- Happy Hacking, Gaurav Vaish | http://www.mastergaurav.org http://www.edujini.in | http://webservices.edujini.in ------------------- thank you, I will be in I await .
You are a legal boy. Show quote "Gaurav Vaish (www.EduJini.IN)" <gaurav.vaish.nospam@nospam.gmail.com> escreveu na mensagem news:OZ0WoshhGHA.1520@TK2MSFTNGP03.phx.gbl... > >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 > ------------------- > > |
|||||||||||||||||||||||