473,748 Members | 4,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Referencing a datagrid control within an HTML table?

Hi, in order to format my web page, I'm starting to use Flow layout so
using html tables to space out controls, etc. When using grid layout,
the following worked when it was just a datagrid. I know I need to
somehow refer to the datagrid within the html table cell, but can't
figure out how.

THANKS!

Public Sub dgConfirmOrder_ ItemDataBound(B yVal sender As System.Object,
ByVal e As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
dgConfirmOrder. ItemDataBound
Select Case e.Item.ItemType
Case ListItemType.Al ternatingItem, ListItemType.It em
'Calculate total for the field of each row and alternating row.
myTotal += CDbl(e.Item.Cel ls(3).Text)
'Format the data, and then align the text of each cell to the right.
e.Item.Cells(3) .Text = Format(CDbl(e.I tem.Cells(3).Te xt),
"##,##0.00" )
e.Item.Cells(3) .Attributes.Add ("align", "right")
Case ListItemType.Fo oter
'Use the footer to display the summary row.
e.Item.Cells(2) .Text = "Total"
e.Item.Cells(2) .Attributes.Add ("align", "left")
e.Item.Cells(3) .Attributes.Add ("align", "right")
e.Item.Cells(3) .Text = myTotal.ToStrin g("c")
End Select
End Sub
Thanks, Kat

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
4 1564
Web controls can be always referred by id regardless where on the page they
are located.

Eliyahu

"KatB" <no****@comcast .net> wrote in message
news:u8******** ******@TK2MSFTN GP10.phx.gbl...
Hi, in order to format my web page, I'm starting to use Flow layout so
using html tables to space out controls, etc. When using grid layout,
the following worked when it was just a datagrid. I know I need to
somehow refer to the datagrid within the html table cell, but can't
figure out how.

THANKS!

Public Sub dgConfirmOrder_ ItemDataBound(B yVal sender As System.Object,
ByVal e As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
dgConfirmOrder. ItemDataBound
Select Case e.Item.ItemType
Case ListItemType.Al ternatingItem, ListItemType.It em
'Calculate total for the field of each row and alternating row.
myTotal += CDbl(e.Item.Cel ls(3).Text)
'Format the data, and then align the text of each cell to the right.
e.Item.Cells(3) .Text = Format(CDbl(e.I tem.Cells(3).Te xt),
"##,##0.00" )
e.Item.Cells(3) .Attributes.Add ("align", "right")
Case ListItemType.Fo oter
'Use the footer to display the summary row.
e.Item.Cells(2) .Text = "Total"
e.Item.Cells(2) .Attributes.Add ("align", "left")
e.Item.Cells(3) .Attributes.Add ("align", "right")
e.Item.Cells(3) .Text = myTotal.ToStrin g("c")
End Select
End Sub
Thanks, Kat

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2
KatB <no****@comcast .net> wrote in news:u8jXW9gsEH A.1176
@TK2MSFTNGP10.p hx.gbl:
I know I need to
somehow refer to the datagrid within the html table cell


you can use the findcontrol method.

Or you can interate through the page.controls collection.

--
Lucas Tam (RE********@rog ers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #3
I used the exact code I provided...it worked UNTIL I put it into an HTML
table cell.

Any specific clues as to why it no longer works it, especially in light
of your answers?

Thanks, Kat

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
Sorry, to clarify, the calculation of the running total no longer
appears in the footer...the grid itself is there.
Thanks, Kat

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5

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

Similar topics

4
2446
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected represents the indes of the actual DataGrid and not the DataView. For example.. Lets say I have 4 rows of data.. In the 4 rows I have an Appt Num of 1,2,3,4... Each representing a data row... I sort DESC so the rows display 4,3,2,1... If I...
2
1601
by: news | last post by:
Hello All, As a VB6/C/C++ (and some Java) developer, I've been toying with c# for the last couple of weeks. I'm currently trying to create a grid of 3x3 with each cell containing numbers from 1 to 9. The idea is that if you push one of the numbers, it gets 'blown up' to the full size of the control, hiding all the other ones. It should also be possible to enable/disable some cells in the grid through calling a method. I've actually...
3
4880
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
4
1152
by: mike parr | last post by:
In a datagrid is it possible to use an imagebutton in for my ButtonColumn rather than the standard button provided? And if so, does anybody have a code example? Cheers, Mike
0
293
by: 2obvious | last post by:
I have a DataGrid containing a TextBox control and a CustomValidator in each row. The CustomValidator fires a function that compares all TextBoxes for equality. The algorithm for comparison is straightforward: *PSEUDOCODE*
3
1948
by: Lyners | last post by:
I have a table within a cell of a datagrid. I am doing updates without postback to the server using Javascript. I have everything working, except referencing a table within the datagrid cell. Here is my datagrid code for the cell; <asp:TemplateColumn HeaderText="3Fields" ItemStyle-Font-Size="8" SortExpression="Field1 ASC" ItemStyle-Font-Name="Verdana"> <ItemTemplate> <table border="0"> <tr>
5
2229
by: lanem | last post by:
I want to display some drill-down data with a datagrid look. I can get the exact functionality I want with a treeview, but I don't like the way the treeview looks and formats the data. I want a multi-column table look like a datagrid. It is not as easy as just hardcoding a datagrid within a datagrid because the data may do down pretty deep. The treeview works great for this. Is there a way to make the treeview look kind of like a...
3
1580
by: tjonsek | last post by:
am working on code that will allow users to update data within the datagrid. I have come across a few problems, some of them I have been able to work out, but this last one is giving me trouble. When a user clicks the edit button, I get an error 'Specified Cast Not Valid'. The code that generates the error is: Dim strCompleted As String = CType(e.Item.Cells(6).Controls(1), TextBox).Text
2
3442
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3 datagrida. I would like to set it so that if value of column 3 in datagrid 1 is < 100 set to red, if = 100 set to green if value of column 3 in datagrid 2 is < 90 set to red, if >= 90 set to green if value of column 3 in datagrid 3is < 80 set to red,...
0
8989
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.