Thanks for the function. It works great.
Peter8675309
Posts
-
Multiple Conditionals -
Setting Colum widths in a datagridWhere is datatablestyles defined? I don't see it in the help of on MS's site. How is this class defined? If it comes from WebControls, I am working on a windows form. Thanks for your help.
-
Setting Colum widths in a datagridYes this is a windows form. If I add in dgResults.TableStyles[0].GridColumnStyles.Clear(); I get an 'index out of range' error unless I prepopulate the TableStyles of the grid prior. I took a look at the code at section 5.3.2 from http://www.codeproject.com/csharp/PracticalGuideDataGrids4.asp#\_Toc56951053. This functions (if I set the dt equal to me dataset.Column), but it still doesn't modify the column widths. X| Thanks for your quick reply.
-
Setting Colum widths in a datagridI am programatically building a dataset that populates a datagrid. I need to then specfify the column widths for each column. However, the grid control ignores my input. I first tried setting the widths under TableStyles/GridColumnStyles. That was ignored so I figured it was because I wasn't populating the grid from a predefined datasource. So then I tried progammatically. Still nothing. Below is my code. The grid should only have one table in it. The grid populates correctly, it just doesn't format the widths of the columns. The dataset only returns 3 columns.:confused: //get the data dsResults = SqlHelper.ExecuteDataset(Conn,CommandType.StoredProcedure,"usp_GetSearchResultsSel",new SqlParameter("@Description", txtDescription.Text),new SqlParameter("@SearchParameters", cboSearchParam.SelectedText)); //populate the grid dgResults.DataSource = dsResults.Tables[0].DefaultView; //settings for grid dgResults.TableStyles[0].GridColumnStyles[0].Width=200; dgResults.TableStyles[0].GridColumnStyles[1].Width=50; dgResults.TableStyles[0].GridColumnStyles[2].Width=100; dgResults.ReadOnly=true;
-
Multiple ConditionalsI am writing a stored procedure where the WHERE clause may contain 100's of conditionals (i.e. UserID=1 OR UserID=2, etc). The field being searched will always be the same. It is just the number records to be returned I won't about. Is there anyways to pass the stored procedure an array or something similar to specify the records to return? Writing a statement that includes 100's of "UserID=1 OR UserID=2 OR..." breaks my layer abstraction so I'd rather just send the list of User ID's I want to get. Is there any way to do something like this?:wtf:
-
Multi-Column WhatNick; Turns out the datagrid WILL work fine. not sure what I was thinking (maybe I wasn't). The only thing I have to do now is programatically set the column widths for the data. :)Thanks for the quick reply.
-
Multi-Column WhatI have a dataset that contains multiple columns of text that needs to be displayed in a control on a Windows form - much like a spreadsheet. The rows need to be selectable so I can retrieve data later on in the application (by being able to retrieve an index or column ID). I'd like the entire row to be selectable rather than just a specific column. I have looked at using a datagrid, but that seems to be overkill. I also looked at some multi-column listbox controls on Code Project but they go much farther than I need my control. Perhaps there is another control or custom control I should use?:confused: