Ask a Question related to ASP.NET General, Design and Development.
-
jonnylbluejeans #1
Trying to hide a datatable column from my datagrid... please help
I've read everywhere to use the following:
objDS.Tables("Results").Columns(0).ColumnMapping = MappingType.Hidden
objDS.AcceptChanges()
dgNotes.DataSource = objDS.Tables("Results")
dgNotes.DataBind()
But, the column still shows? Can anyone shed some light on this?
jonnylbluejeans Guest
-
Bound datatable + unbound column in datagrid
Is is possible to create an ASP.NET datagrid that mixes bound data pulled from a database table with an unbound column created by the program? I... -
How to add New Column to existing DataTable in specific position.
I want to add new DataColumn to existing DataTable object as first column shown in the datagrid. (like DataColumn dc = new DataColumn("Target");... -
Binding Two DataTable Columns to One DataGrid Column
I have a DataTable that I am binding to a DataGrid. I need to take two columns in the DataTable, and bind them to one row in the DataGrid (for... -
How can I hide a column in my Datagrid
I have a datagrid I am populating programmatically, creating the rows and columns. I need to hide one column. How can I do this? I have seen... -
DataTable - replace values in column
How would I replace all the values in a column in a DataTable with another value (which is the same for every row)? -
S. Justin Gengo #2
Re: Trying to hide a datatable column from my datagrid... please help
jonny,
I haven't seen any code like you're using before.
I hide columns by simply setting the column's visibility property.
Here's how I do it when I'm creating the datagrid myself:
<asp:boundcolumn visible="False" datafield="pk_EntryId"></asp:boundcolumn>
And here's how I set it from the codebehind:
DataGrid1.Columns(0).Visible = False
I hope this helps.
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
[url]www.aboutfortunate.com[/url]
"Out of chaos comes order."
Nietzche
"jonnylbluejeans" <john.lepone@arch.com> wrote in message
news:uEa8ITVUDHA.1992@TK2MSFTNGP12.phx.gbl...> I've read everywhere to use the following:
>
> objDS.Tables("Results").Columns(0).ColumnMapping = MappingType.Hidden
>
> objDS.AcceptChanges()
>
> dgNotes.DataSource = objDS.Tables("Results")
>
> dgNotes.DataBind()
>
>
>
> But, the column still shows? Can anyone shed some light on this?
>
>
S. Justin Gengo Guest
-
Christopher Frazier #3
Re: Trying to hide a datatable column from my datagrid... pleasehelp
Perhaps your problem lies within the implementation of the DataGrid -
have you tried using bound columns instead of just databinding to the
default Grid?
-Christopher
[url]http://weblogs.asp.net/CFrazier[/url]
jonnylbluejeans wrote:
> I've read everywhere to use the following:
>Christopher Frazier Guest
-
Jerry #4
Re: Trying to hide a datatable column from my datagrid... please help
Use the ItemCreated Event to
Private Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemCreated
Select Case e.Item.ItemType
Case ListItemType.Header,ListItemType.AlternativeItem,L istItemType....
e.Item.Cells(1).Visible = False
End Sub
"jonnylbluejeans" <john.lepone@arch.com> wrote in message
news:uEa8ITVUDHA.1992@TK2MSFTNGP12.phx.gbl...> I've read everywhere to use the following:
>
> objDS.Tables("Results").Columns(0).ColumnMapping = MappingType.Hidden
>
> objDS.AcceptChanges()
>
> dgNotes.DataSource = objDS.Tables("Results")
>
> dgNotes.DataBind()
>
>
>
> But, the column still shows? Can anyone shed some light on this?
>
>
Jerry Guest
-
Rick Spiewak #5
Re: Trying to hide a datatable column from my datagrid... please help
Thanks for this one! It solved a different problem for me:
If I set a column's Visible property to False (unchecking in the columns
property page), the value read from it is empty. Using this technique makes
the column invisible without causing that side-effect.
Frankly, in the case of my problem, I think it's a bug!! But, whatever it
takes....
"Jerry" <JGAO2183@rogers.com> wrote in message
news:jMITa.20466$vz%.12010@news01.bloor.is.net.cab le.rogers.com...> Use the ItemCreated Event to
> Private Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DataGridItemEventArgs) Handles
> DataGrid1.ItemCreated
>
> Select Case e.Item.ItemType
>
> Case ListItemType.Header,ListItemType.AlternativeItem,L istItemType....
>
> e.Item.Cells(1).Visible = False
>
>
> End Sub
>
>
> "jonnylbluejeans" <john.lepone@arch.com> wrote in message
> news:uEa8ITVUDHA.1992@TK2MSFTNGP12.phx.gbl...>> > I've read everywhere to use the following:
> >
> > objDS.Tables("Results").Columns(0).ColumnMapping = MappingType.Hidden
> >
> > objDS.AcceptChanges()
> >
> > dgNotes.DataSource = objDS.Tables("Results")
> >
> > dgNotes.DataBind()
> >
> >
> >
> > But, the column still shows? Can anyone shed some light on this?
> >
> >
>
Rick Spiewak Guest



Reply With Quote

