egdotnet Posted August 6, 2004 Posted August 6, 2004 I have a datagrid, which is bound to a datatable with 4 or 5 columns, which in turn gets its data through a function from an xml document. now i need to have an ID column for things the datagrid the does, but don't want it to be visible. i tried using: mydatagrid.columns(1).visible = false but since the columns are bound at runtime, they appear when the page runs, but if i have it count the columns, the only one it knows is the one created at design time with the "select" button in each row. so is there a way to keep a bound column there, but make it invisible to the user? Quote
Joe Mamma Posted August 6, 2004 Posted August 6, 2004 I have a datagrid, which is bound to a datatable with 4 or 5 columns, which in turn gets its data through a function from an xml document. now i need to have an ID column for things the datagrid the does, but don't want it to be visible. i tried using: mydatagrid.columns(1).visible = false but since the columns are bound at runtime, they appear when the page runs, but if i have it count the columns, the only one it knows is the one created at design time with the "select" button in each row. so is there a way to keep a bound column there, but make it invisible to the user? So this is a row ID? or a common ID, where it is the same ID for every row in the column? Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
egdotnet Posted August 6, 2004 Author Posted August 6, 2004 This is a row ID (remember that the it needs to remain consistent with the row it represents even when i sort, change pages), but unless there's a special way of assigning IDs (is there?), i'm not sure why that should matter. Quote
Moderators Robby Posted August 6, 2004 Moderators Posted August 6, 2004 try this... mydatagrid.Columns.Item(0).Visible = false Quote Visit...Bassic Software
egdotnet Posted August 8, 2004 Author Posted August 8, 2004 invisible bound column anybody know how to make a column bound at runtime invisible because the above suggestion didn't work? Quote
Tamer_Ahmed Posted August 8, 2004 Posted August 8, 2004 Try this myDataGrid.column(ur column's index).visible = False and it's work i Tried it Quote
egdotnet Posted August 8, 2004 Author Posted August 8, 2004 but it doesn't! ive tried it tons of times & it can see the column created @ design time (w/ the select button) but if i have it tell me the number of columns in the grid, it only sees 1. it shows the other ones but i can't make them invisible. Quote
egdotnet Posted August 8, 2004 Author Posted August 8, 2004 the only thing is maybe i'm putting it in the wrong place... here's where i've been putting it: datagrid1.datasource = showdata() datagrid1.databind datagrid1.columns(1).visible = false (i get an error here) Quote
egdotnet Posted August 8, 2004 Author Posted August 8, 2004 i found this on MSDN: "When using both, explicitly declared columns will be rendered first, followed by the automatically generated columns. Automatically generated columns are not added to the Columns collection." (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclasscolumnstopic.asp) Mine are automatically generated so how do i make those invisible? Quote
egdotnet Posted August 8, 2004 Author Posted August 8, 2004 what is the error message say Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Quote
Tamer_Ahmed Posted August 8, 2004 Posted August 8, 2004 i think ur problem's in The Method showData() coz i tried the code in many ways and it's work ur problem in this method check the code there Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.