![]() |
| |||||||
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
| ||||
| I would use OnSelectedIndexChanged on the DDL and have a sub in code behind that handles the change and populates the other DDL rather than having a control within the page. There's no reason why the datasource control method shouldn't work though... |
| Sponsored Links |
| ||||
| just tried this: Code: Public Property Name() As String
Get
HttpContext.Current.Response.Write("BO Name = " & _name)
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
![]() |
| ||||
| .aspx page Code: <asp:DropDownList id="DDL1" runat="server" autopostback="True" OnSelectedIndexChanged="DDL1_OnSelectedIndexChanged" /> <asp:DropDownList id="DDL2" runat="server" /> Code: Protected Sub DDL1_OnSelectedIndexChanged(ByVal s As Object, By Val e As EventArgs)
Dim conn as New MySQLConnection(ConnDal.ConnString)
Dim mycommand as New MySQLCommand("SELECT id,name FROM tbl WHERE primary_id=?id", conn)
Dim rs As MySQLDataReader
Try
mycommand.Parameters.AddwithValue("id",DDL1.SelectedValue)
conn.open
rs = mycommand.ExecuteReader()
if rs.HasRows then
DDL2.DataSource=rs
DDL2.DataValueField = "id"
DDL2.DataTextField = "name"
DDL2.DataBind()
end if
rs.close()
catch ex as Exception
update_error.visible = True
update_error.text = ex.ToString
finally
mycommand.dispose()
conn.close()
conn.dispose()
end try
end sub
Quote:
Try moving the myZones.Name code to right underneath the IdKey code. Code: myZones.Idkey = myDataRecord.GetInt32(myDataRecord.GetOrdinal("idkey"))
myZones.Name = myDataRecord.GetString(myDataRecord.GetOrdinal("name"))
myZones.ProjectID = myDataRecord.GetInt32(myDataRecord.GetOrdinal("project_id"))
myZones.UserID = myDataRecord.GetInt32(myDataRecord.GetOrdinal("userID"))
myZones.Edited = myDataRecord.GetInt32(myDataRecord.GetOrdinal("edited"))
myZones.Description = myDataRecord.GetString(myDataRecord.GetOrdinal("description"))
Return myZones
End Function
|
| ||||
| Have you tried just using:- Code: If Not IsDBNull(myDataRecord("name")) then myZones.Name = myDataRecord("name")
|
| ||||
| Are you using MySQL or MS SQL? I found this on the MySQL website, but looks like it's all been resolved. Would any of the records contain a NULL value for any of the fields you're returning? |
| ||||
| shem, try debugging your app: Walkthrough: Debugging Web Pages in Visual Web Developer I would start off with setting a breakpoint on the FillDataRecord function and see if a value is actually being set or not.
__________________ jmurrayhead Did I help you out? Make me popular by clicking the icon!If you found a post helpful, please click the button in the lower right-hand corner of the post.Powered by ASP.Net |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| populate combobox from another | Jaykappy | Microsoft Access | 4 | May 7th, 2008 02:56 PM |
| WebCharts Control | richyrich | .Net Development | 1 | April 4th, 2008 11:14 AM |
| Sponsored Links |
| ASP.NET Resource Index a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer. Free Web Directory Including Chats and Forums Resources, Offer automatic, instant and free directory submissions. | URLZ Web Directory URLZ Web Directory Free Web Directory - Add Your Link The Little Web Directory | Free Web Directory Pegasus free web directory is a free directory organised by categories. Web Directory & SEO Services dirroot web directory |