473,322 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Function for GridView

Hello, I am using the following GridView control. What I would like to do
is for each row, test to see if the DataField="Product" value = "Total". If
so, make the text for each bound field bold. Looking through the
documentation, I am assuming that I would use the event (RowCreated). My
question is, how would I reference the datafield in a function?

Thanks, in advance, sck10
<asp:GridView ID="gvWebDocList" Runat="server" DataSourceID="dsWebDocList"
AutoGenerateColumns="False" AllowPaging="True" PageSize="40">

<Columns>
<asp:BoundField DataField="Product" HeaderText="Product" />
<asp:BoundField DataField="ProductCount" HeaderText="Total" />
</Columns>
</asp:GridView>
Nov 18 '05 #1
4 2602
Sck10,
You will have to muck with the GridView's Controls collection to get a
reference to the textboxes rendered in each column. In the RowCreated or
RowDataBound event, you can use e.Row.Controls to go through the fields.
Turn Trace on to visually see the page control hierarchy. This will help
you locate the controls you need. If you have to do some special things
with the rows, using a TemplateColumn would make it easier. That way you
would get to name the controls so you can find them better.

Best regards,
Jeffrey Palermo

"sck10" <sc***@online.nospam> wrote in message
news:ON**************@TK2MSFTNGP15.phx.gbl...
Hello, I am using the following GridView control. What I would like to do
is for each row, test to see if the DataField="Product" value = "Total". If so, make the text for each bound field bold. Looking through the
documentation, I am assuming that I would use the event (RowCreated). My
question is, how would I reference the datafield in a function?

Thanks, in advance, sck10
<asp:GridView ID="gvWebDocList" Runat="server" DataSourceID="dsWebDocList"
AutoGenerateColumns="False" AllowPaging="True" PageSize="40">

<Columns>
<asp:BoundField DataField="Product" HeaderText="Product" />
<asp:BoundField DataField="ProductCount" HeaderText="Total" />
</Columns>
</asp:GridView>

Nov 18 '05 #2
Thanks for Jeffery's suggestions.

Hi Sck10,

From your description, I'm wondering whether you're wanting to set the bold
font for all the column headers in the GridView? If so , you can consider
using the HeaderStyle or any other style setting for the grid rather than
manually retriving the text and set bold on them. How do you think ?
If there're any thing I'm misunderstanding, please feel free to let me
know. Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #3
Hi Steve,

What I am trying to do is determine if the text for the DataField that is
retrieving the "Product" data is equal to "Total". If so, then make all the
data fields for that particular row bold. My last row of the data being
pulled from SQL Server is a totals row.
"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:Li**************@cpmsftngxa10.phx.gbl...
Thanks for Jeffery's suggestions.

Hi Sck10,

From your description, I'm wondering whether you're wanting to set the bold font for all the column headers in the GridView? If so , you can consider
using the HeaderStyle or any other style setting for the grid rather than
manually retriving the text and set bold on them. How do you think ?
If there're any thing I'm misunderstanding, please feel free to let me
know. Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #4
Thanks for your followup Sck10,

Then, I think you can consider Jeffrey 's suggestion on making use of the
ItemBound or ItemCreated event and retrive the binded data and compare
their values.
Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Martin B | last post by:
Hallo to everyone! Problem: -------- GridView Exception: reentrant call to the SetCurrentCellAddressCore function System: ------- WinXP Professional, english, .NET Framework 2.0 Beta...
2
by: dba123 | last post by:
How do I take my GridView and create a function that will update -all- checkbox values for the submit button's OnClick event? I have posted both my SQLDataSource and my GridView below: ...
2
by: | last post by:
I want to know how to make a clickable button or Command field on a GridView, and have the user's action a) fire a function and b) pass a data value from one of the GridView's columns to that...
2
by: Deere | last post by:
Keep in mind I'm an old guy who is learning .net. In asp classic I had a trash can icon in my shopping cart that would delete a record. In trying to accomplish the same in gridview I've used a...
0
by: russganz | last post by:
I have a gridview that displays user ratings as 'stars' from a jpg file. The template field is defined as <asp:TemplateField HeaderText="User Rating"> <ItemTemplate> <img src='<%#...
5
by: pbearne | last post by:
Hi guys I am trying to this function below I have a web form with a load of inputs text boxs etc and i need to disable them So I have tried to write a function I can call and get the...
1
by: gabe | last post by:
How do you call a client side javascript callback method after an update panel has posted back to the server? I have two update panels (A + B) with a gridview in each panel. GridView B has a...
0
by: troydixon | last post by:
Hello, I am new at this, and have been trying to insert data into a table by using the footer of a gridview (which I dont like) or by using a detials view on the same page that is doing the...
4
by: Ken Fine | last post by:
I'm making an administrative interface that lists records in a GridView. For *each* row in the gridview, I would there to be two interface elements in addition to some information associated with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.