This is a migrated thread and some comments may be shown as answers.

Trying to bind textbox to an arraylist

1 Answer 250 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 13 Jul 2009, 12:54 AM

I have a dataset that contains multiple tables in it. What I want to do is find a way to take the values(and when I say "values" I do mean the plural "values") from a column within one table of the dataset and display them in a  textbox. When I try to feed the values into an arraylist the values do not display correctly in design time. (Just shows the namespace object in the preview tab of VisualStudio) When I add the values to a string, I get the last value in the column which doesn't help me but it at least means I can iterate through the column values.  Any idea as to how to make this work? How to get all the values in the column and bind to a textbox value. Below is the code i'm trying to use.
-Jason

   SqlConnection connSomsys = new SqlConnection(@"Server=cmdivst004\Jason08;Integrated Security=false;Database=QuoteDB; Persist Security Info=True;User ID=cmdiapp;Password=adiadmin");  
            SqlCommand selectCommand;  
            connSomsys.Open();  
              
            selectCommand = new SqlCommand("sprocgetProductListQuoteTotals", connSomsys);  
            selectCommand.CommandType = CommandType.StoredProcedure;  
            SqlDataAdapter adapter = new SqlDataAdapter(selectCommand);  
            DataSet dataSet = new DataSet();  
            adapter.Fill(dataSet);  
            ArrayList myAL = new ArrayList();  
             
            DataTable tbl = dataSet.Tables[1];  
            for (int i = 0; i < tbl.Rows.Count; i++)  
            {  
 
 
                DataRow myRow = tbl.Rows[i];  
                myAL.Add(myRow["ProductList"].ToString());  
 
 
            }  
 
              textBox4.Value = myAL.ToString();  
 

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 15 Jul 2009, 04:32 PM
Hello Jason,

Only the report and table items can be bound to a datasource. Once they're bound, you can bind a textbox to a column, which if the textbox is in the detail section would be repeated for as many times as the rows in your datasource i.e. show all values of the column in question.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Jason
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or