Create control at runtime

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2007
Posts: 34
Reputation: shy_wani is an unknown quantity at this point 
Solved Threads: 0
shy_wani shy_wani is offline Offline
Light Poster

Create control at runtime

 
0
  #1
May 1st, 2007
i've got this code to create control at runtime..
the problem is that i've forgotten the link and i can't refer to its documentation....
the problem is...i don't understand this line:
Dim parent As String = CStr(ds.Tables(1).Rows(0)("Parent"))

what does this parent refer to?

  1. Dim options As New RadioButtonList
  2. For Each row As DataRow In ds.Tables(0).Rows
  3. Dim item As New ListItem
  4. item.Text = CStr(row("Name"))
  5. item.Value = CStr(row("Id"))
  6. options.Items.Add(item)
  7. Next
  8. Dim parent As String = CStr(ds.Tables(1).Rows(0)("Parent"))
  9. Select Case parent
  10. Case "sideNav"
  11. columnSidenav.Controls.Add(options)
  12. Case "footer"
  13. footerCoontainer.Controls.add(options)
  14. Case Else
  15. paceholderDefault.Controls.add(options)
  16. End Select

~i wanted to learn more~
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 11
Reputation: jabijohn is an unknown quantity at this point 
Solved Threads: 1
jabijohn jabijohn is offline Offline
Newbie Poster

Re: Create control at runtime

 
0
  #2
May 2nd, 2007
Originally Posted by shy_wani View Post
i've got this code to create control at runtime..
the problem is that i've forgotten the link and i can't refer to its documentation....
the problem is...i don't understand this line:
Dim parent As String = CStr(ds.Tables(1).Rows(0)("Parent"))

what does this parent refer to?

  1. Dim options As New RadioButtonList
  2. For Each row As DataRow In ds.Tables(0).Rows
  3. Dim item As New ListItem
  4. item.Text = CStr(row("Name"))
  5. item.Value = CStr(row("Id"))
  6. options.Items.Add(item)
  7. Next
  8. Dim parent As String = CStr(ds.Tables(1).Rows(0)("Parent"))
  9. Select Case parent
  10. Case "sideNav"
  11. columnSidenav.Controls.Add(options)
  12. Case "footer"
  13. footerCoontainer.Controls.add(options)
  14. Case Else
  15. paceholderDefault.Controls.add(options)
  16. End Select

~i wanted to learn more~
"parent" is the column name in that specific context, the line is going to return the 1st row parent column value to "string var"
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC