|
Okay, I'm a little stuck. I have posted my code of how I am filling my DDL. I am using a datareader.
Protected Sub FillOptionsList()
ddl1.Items.Clear()
Dim sqlStr As String = "SELECT Option1, Option2, Option3 FROM TblOptions WHERE Bid=1"
Dim con As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("myConnection").ConnectionString)
Dim cmd As New SqlCommand(sqlStr, con)
Dim reader As SqlDataReader
Try
con.Open()
reader = cmd.ExecuteReader()
Do While reader.Read()
Dim newItem As New ListItem()
newItem.Value = reader("Option1").ToString()
newItem.Text = reader("Option2")
ddl1.Items.Add(newItem)
Loop
reader.Close()
Catch ex As Exception
Label1.Text = "Error Reading list" & " " & Err.Description
Finally
con.Close()
End Try
End Sub
Please can you help me with the code to get option3 into an 'unseen column' within the DDL? I have tried a few things (not posted) but with no success, and I can't find any help online for this feature.
Thanks.
|
|
|
|
|
Hi all, i have a little problem that even i don't know like solve. I know that is possible but I don't know how.
I have a project ASP.NET with VBasic.NET
I want to add a dropdownlist to DetailsView with diferent source that detailsview.
I put my code and the error:
Dim InsertComboUsuarios As DropDownList = DirectCast(detailsView.FindControl("InsertComboUsuarios"), DropDownList)
Dim UsuariosServicios As New DataTable
UsuariosServicios = Servicios.ObtenerUsuariosServicios()
InsertComboUsuarios.DataSource = UsuariosServicios
InsertComboUsuarios.DataTextField = UsuariosServicios.Columns("Usuario").ColumnName.ToString()
InsertComboUsuarios.DataValueField = UsuariosServicios.Columns("IdUsuario").ColumnName.ToString()
InsertComboUsuarios.DataBind()
the code in aspx:
<asp:TemplateField HeaderText="Usuario del Servicio" >
<ItemTemplate>
<asp:Label ID="lblUsuario" Text='<%# Eval("Id_Usuario") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="EditComboUsuarios" runat="server"></asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="InsertComboUsuarios" runat="server"></asp:DropDownList>
</InsertItemTemplate>
</asp:TemplateField>
and the error is:
System.NullReferenceException was caught
Message="Referencia a objeto no establecida como instancia de un objeto."
Source="App_Web_ie3hu1zc"
The source failed when pass by InsertComboUsuarios.DataSource = UsuariosServicios
some idea?
thanks very much for your help
|
|
|
|
|
Hi Sandraa,
I have done this many times. I don't know exactly why it does not work for you (did not try it out), however, I want to show you a snippet of my working code. Besides being C# the main difference is that I use declarative syntax only:
First the dropdown declaration in the .aspx file:
<br />
<asp:dropdownlist ontextchanged="OnTextChanged" xmlns:asp="#unknown"><br />
SelectedValue='<%# Bind("fake_flag1")%>' <br />
ID="ddl_test1" <br />
DataSourceID="TestDS" <br />
DataTextField="someDescription" <br />
DataValueField="someID" <br />
runat="server"><br />
</asp:dropdownlist><br />
Next the declaration of the datasource for the above dropdown, which is different of the detailsview the dropdown is in:
<br />
<asp:sqldatasource id="TestDS" runat="server" connectionstring="<%$ ConnectionStrings:ConnectionString %>" xmlns:asp="#unknown"><br />
SelectCommand="SELECT * FROM TEST"><br />
</asp:sqldatasource><br />
Hope this helps. Maybe the problem in your code is the point in time when you try to set the datasource?
Cheers,
Marcelo
|
|
|
|
|
Thanks Marcelo but your code is for aspx and I am using aspx.vb, I don't know like call well to dropdownlist from aspx.vb page and from detailsview.
Remenber that my dropdownlist is into a detailsview
Thanks for all
|
|
|
|
|
Sandraa wrote: but your code is for aspx and I am using aspx.vb
Yes, he said you'd have to convert C# to VB, that's trivial to do. Also, he said he's doing it in the aspx, is there any reason you can't try it that way ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi Sandraa,
Are you sure
Dim InsertComboUsuarios As DropDownList = DirectCast(detailsView.FindControl("InsertComboUsuarios"), DropDownList)
This line is returning you a DropDownList object ???
That is to say InsertComboUsuarios is not null ??
|
|
|
|
|
I believe that yes, I put you the code in aspx page
<asp:TemplateField HeaderText="Usuario del Servicio" >
<ItemTemplate>
<asp:Label ID="lblUsuario" Text='<%# Eval("Id_Usuario") %>' runat="server"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="EditComboUsuarios" runat="server"></asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="InsertComboUsuarios" runat="server"></asp:DropDownList>
</InsertItemTemplate>
</asp:TemplateField>
I believe that I have put something bad in this code.
Thanks for your help.
|
|
|
|
|
S.O.S
Even I continue with this problem, please any idea?
|
|
|
|
|
How to load any configuration file other than web.config ? It may be a custom configuration file.
|
|
|
|
|
I didn't know, but gosh[^], it sure was easy to find out.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
Can you help me,to get a free hosting of ASP with Mysql, i try for brinkster, unfortunatly they aren't Mysql, thank you verry mutch
modified on Sunday, December 14, 2008 1:13 PM
|
|
|
|
|
You mean ASP.NET, right ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
I just wonder if it really matters between MSSQL and MySQL. In my opinion, it is best to keep MSSQL bundled with ASP.NET.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
No, MySQL is better, because, it's FREE, dude. I mean, it's not ACTUALLY free, and SQL Server express IS, but let's not get confused by facts here....
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Mysql or sqlserver, i need the free hosting, help me please
|
|
|
|
|
I have no idea, I tend to prefer to pay my way and to know if I need a website up, I have a reason to expect it to stay up. There are free servers tho, have you tried to google ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
True, but what I was meaning was usually most web hosts will bundle MSSQL with their hosting packages. I do not know of many that have MySQL and ASP together. Usually most that have MySQL are LAMP setups. I've seen a few that swing both ways, not many though.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
hello,
i have created an application who's platform are asp.net1.1,windows XP,Access 2002 and its working fine in my PC.
When i aploaded it on a server who's platform is .NET Framework 2.0,windows server 2003,Access 2003 and when i am browsing a page who has database connectivity it throws an error as 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine".
I tried installing latest MDAC on the server but still showing the same problem.
Thank you.
coolsatty
|
|
|
|
|
coolsatty wrote: who's platform are asp.net1.1,
coolsatty wrote: who's platform is .NET Framework 2.
Have you tried running the site on a local machine that doesn't have 1.1, and does have 2.0, to see what happens ? I would be surprised if it worked, there were big changes in ASP.NET.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
I have made a web application in ASP.NET. I wish that When i give http://localhost/web1/default.aspx in address bar of browser, it should open in full screen mode i.e. no menubar, no addressbar etc. without opening a new window. It should full screen it self.
What should i code, please tell me.
Thanks & Regards
Girish Sharma
|
|
|
|
|
One more person who has no idea what ASP.NET is, or does.
You can't force the browser into full screen mode. You can't even guarantee that the browser HAS a full screen mode.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
I know what you want. DId it seem like I didn't know ? How does that change my answer ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Any update please...!
means is it not possible by either javascript and/or ASP.NET?
Regards
Girish
|
|
|
|