Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Strange Source

Thread Tools

Strange Source
Posts: n/a
A ASP.NET page has only a DataGrid control whose ID is "DGrid1". The
Page_Load sub looks like this::

Sub Page_Load(.....)
'binding the DataGrid
'to some data source

Dim child As Control
For Each child In DGrid1.Controls
End Sub

<aspataGrid ID="DGrid1" AutoGenerateColumns="false"
BorderColor="dodgerblue" CellPadding="1" CellSpacing="1"
EnableViewState="true" GridLines="both"
HeaderStyle-BackColor="dodgerblue" HeaderStyle-Font-Bold="true"
HeaderStyle-Font-Names="courier new" HeaderStyle-Font-Size="smaller"
HeaderStyle-ForeColor="white" HeaderStyle-HorizontalAlign="center"
ItemStyle-Font-Names="courier new" ItemStyle-Font-Size="smaller"
ShowFooter="false" Width="500" runat="server">

Note that the first Response.Write line is commented.

Now when I have a look at the source code of the ASPX page (by
navigating to "View"---->"Source" menu in IE6.0), then the
corresponding HTML of the DataGrid is this:

<table id="DGrid1_ctl00" cellspacing="1" cellpadding="1" rules="all"
border="1" id="DGrid1" style="border-colorodgerBlue;width:500px;">

Note that the HTML <table> has 2 "id" attributes - 'DGrid1_ctl00' &
'DGrid1'. Next I uncomment the first Response.Write line & comment the
second Response.Write line in the above code. Then the corresponding
HTML source of the DataGrid turns out to be

<table cellspacing="1" cellpadding="1" rules="all" border="1"
id="dgMarks" style="border-colorodgerBlue;width:500px;">

In this case, the HTML <table> has only 1 "id" attribute.

Now why this discrepancy in the source code?

Note that the page behavior remains the same under both circumstances.

Reply With Quote

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Source ASP .Net 0 12-08-2006 03:19 PM
AVG Email Scanner activating at strange times with strange IP addresses Computer Support 1 08-26-2006 04:27 AM
Javascript source files are acting strange with asp Jason Javascript 3 11-03-2004 10:23 PM
Question About Strange 'C' Code Syntax ( Well strange to me anyway ) Harvey Twyman C Programming 8 10-25-2003 05:54 AM
strange source code Developwebsites HTML 3 08-07-2003 07:51 AM