Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 02-14-2006, 04:06 AM   #1 (permalink)
rikb53
Registered User
 
Join Date: Jan 2006
Posts: 29
rikb53 is on a distinguished road
e.itme.Cells(3).text HELP

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
rikb53 is offline   Reply With Quote
Old 02-17-2006, 06: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
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 07:17 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting