- sourcecode.zip
- SourceCode
- Csharp
- Components
- Business
- Data
- Interface
- Parent
- Web
- CSS
- Errors
- Images
- bg_navigation.gif
- delete.gif
- logobanner.gif
- new.gif
- top.jpg
- update.gif
- Login
- UserControls
- Scripts
- ThreeTierGenerator
- VB
- Components
- Business
- Data
- Interface
- Parent
- Web
- CSS
- Errors
- Images
- bg_navigation.gif
- delete.gif
- new.gif
- top.jpg
- update.gif
- UserControls
- demo.zip
- Demo
- ThreeTierDemo
- ThreeTierDemoVB
|
'*********************************************************************
'
' WebChamps.Dummy Namespace
'
'*********************************************************************
Namespace WebChamps.Components.Web
Public Class DynamicListControl
'*********************************************************************
'
' DynamicDropdownlist Method
'
' Generates Dynamic Dropdownlist.
'
'*********************************************************************
Public Overloads Shared Sub Create(ByRef MsListControl As System.Web.UI.WebControls.ListControl, ByVal DataTextStr As String, ByVal DataTextField As String, ByVal DataValueField As String, ByVal TableName As String, ByVal SelectedValue As String, ByVal FirstValue As String)
Dim MsDataReader As System.Data.SqlClient.SqlDataReader
Try
MsDataReader = DataClient.ExecuteReader(DataTextStr, DataTextField, DataValueField, TableName)
Catch ex As Exception
Throw New Exception(ex.ToString)
End Try
MsListControl.DataSource = MsDataReader
MsListControl.DataTextField = DataTextField
MsListControl.DataValueField = DataValueField
MsListControl.DataBind()
If Not (TypeOf MsListControl Is ListBox) Then
MsListControl.Items.Insert(0, New ListItem("Select", FirstValue))
End If
MsDataReader.Close()
Try
If Not IsNothing(MsListControl.Items.FindByValue(SelectedValue)) Then
MsListControl.Items.FindByValue(SelectedValue).Selected = True
End If
Catch ex As Exception
Throw New Exception(ex.ToString)
Finally
End Try
End Sub
Public Shared Function ExecuteDataView(ByVal DataTextStr As String, ByVal DataTextField As String, ByVal DataValueField As String, ByVal TableName As String) As System.Data.DataView
Try
Return DataClient.ExecuteDataView(DataTextStr, DataTextField, DataValueField, TableName)
Catch ex As Exception
Throw New WebChamps.Components.Web.AppException("An error occurred while executing the WebChamps.Components.Web.ExecuteDataView", ex)
Finally
End Try
End Function
End Class
End Namespace
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Stevan is a Microsoft Certified Solutions Developer in .Net Architecture (MCSD.Net Early Achiever – one among the first 2500 worldwide), Microsoft Certified Application Developer in .Net – MCAD.Net (Charter Member - one among the first 5000 developers worldwide).