stevet26
Programmer
- Feb 9, 2005
- 53
Hi
I have an default.aspx page which calls in a user control containing a datagrid.
The datagrid has two columns, Name and Value. The name column is filled in automatically by the user controls code behind. The value filed is left empty because it needs to be populated by the default page.
The default page contains a couple of text fileds and a drop down box. Depending on what is seleteded in the drop down box determins whether the user control is called in or not.
If the user control is called in, I need to take a a comma separated string from the database, split it and loop through the rows in the datagrid adding a each split item to the datagrids value column.
Now i can find the datagrid fine how ever it is having a problem with the loop. Here is the code
Dim datTemplateFile As SqlDataReader
Dim strString As String
Dim arrArray() As String
Dim strItem As String
Dim icount As Integer
Dim urcHiddenPanel As Control = CType(plcContainer.FindControl("urcHiddenPanel"), Control)
Dim grdStoredProc As DataGrid = CType(urcHiddenPanel.FindControl("grdStoredProcParams"), DataGrid)
strString = datTemplateFile("TC_StoredProcParams")
arrArray = strString.Split(",")
icount = 0
For Each strItem In arrArray
grdStoredProc.Items(icount).Cells(1).Text = strItem
icount = icount + 1
Next
If anyone has experienced a problem like this before and solved it then any assistance would be much appreciated.
Thanking you in advance.
I have an default.aspx page which calls in a user control containing a datagrid.
The datagrid has two columns, Name and Value. The name column is filled in automatically by the user controls code behind. The value filed is left empty because it needs to be populated by the default page.
The default page contains a couple of text fileds and a drop down box. Depending on what is seleteded in the drop down box determins whether the user control is called in or not.
If the user control is called in, I need to take a a comma separated string from the database, split it and loop through the rows in the datagrid adding a each split item to the datagrids value column.
Now i can find the datagrid fine how ever it is having a problem with the loop. Here is the code
Dim datTemplateFile As SqlDataReader
Dim strString As String
Dim arrArray() As String
Dim strItem As String
Dim icount As Integer
Dim urcHiddenPanel As Control = CType(plcContainer.FindControl("urcHiddenPanel"), Control)
Dim grdStoredProc As DataGrid = CType(urcHiddenPanel.FindControl("grdStoredProcParams"), DataGrid)
strString = datTemplateFile("TC_StoredProcParams")
arrArray = strString.Split(",")
icount = 0
For Each strItem In arrArray
grdStoredProc.Items(icount).Cells(1).Text = strItem
icount = icount + 1
Next
If anyone has experienced a problem like this before and solved it then any assistance would be much appreciated.
Thanking you in advance.