View Single Post
Old 02-17-2006, 07:51 PM   #2 (permalink)
iowacb4600f4guy
Registered User
 
Join Date: Feb 2006
Location: Clive, iowa
Posts: 3
iowacb4600f4guy is on a distinguished road
Send a message via AIM to iowacb4600f4guy
Quote:
Originally Posted by rikb53
GUYS i need some datagrid help here.
i can make a button column with an image - no problem -
when its clicked it would go and get
the info, for instance from>

e.Item.Cells(3).Text - the button is hit and it grabs the info from that cell.

here's the deal - whats in Cell number 3 is a primary key and i need to use that to find the correct row.

but, my boss, doesnt want that cell to show in the grid - at all.
so the only way i know to do this is to template the columns. i.e. below:
and then
<asp:TemplateColumn HeaderText="CDID" Visible="False">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "IterationID") %>
</ItemTemplate>
</asp:TemplateColumn>


but when i template the columns and turn AutoGenerateColumns="False"
it no longer finds the info in the cell as before (e.Item.Cells(3).Text) and it doesnt matter whether that property is visible or not.
can someone help me with this?????

thanks for any help
rik
TO hide the item you do not have to use template columns, you can use "BoundColums" they have a visible property in them. You will want to keep auto generate columns turned off. Additionally if this is your "Primary Key" you could set the "DataKeyValue" property of the datagrid and loop this up without having to retreive the data from your grid.

Here is an example of multiple colums, but 1 hidden.
<Columns>
<asp:BoundColumn Visible="False" DataField="keyRecordId"> </asp:BoundColumn>
<asp:BoundColumn DataField="strTitle" HeaderText="Title">
</asp:BoundColumn>
</Columns>

YOu can access the value of key record id then by e.items.cells(0).text
iowacb4600f4guy is offline   Reply With Quote