473,508 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you inspect HTML controls in compiled C#?

I have a C# application that builds dynamic HTML and renders it. Because it
is rendered in this way, the input controls are not server controls. I write
the entire page, which has a variable number of detail lines for an order. I
want the user to be able to change values on these detail lines and hit an
'update' button. I know how to do this in Javascript, but I'd like to be
able to inspect the controls that come back to my C# program during a
Postback. Since these are not server controls, they are not available in
Page.Controls. What is the 'proper' way to inspect these inside of the
compiled C# program? Right now I'm parsing them out through javascript, and
passing them through cookies, but there has to be a better way than this,
isn't there?
Nov 19 '05 #1
5 2077
Hi Brian,

Do you have Visual Studio.Net? If so, three are oodles of ways to inspect
process and data in your app, using BreakPoints, Watches, etc.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
I have a C# application that builds dynamic HTML and renders it. Because
it
is rendered in this way, the input controls are not server controls. I
write
the entire page, which has a variable number of detail lines for an order.
I
want the user to be able to change values on these detail lines and hit an
'update' button. I know how to do this in Javascript, but I'd like to be
able to inspect the controls that come back to my C# program during a
Postback. Since these are not server controls, they are not available in
Page.Controls. What is the 'proper' way to inspect these inside of the
compiled C# program? Right now I'm parsing them out through javascript,
and
passing them through cookies, but there has to be a better way than this,
isn't there?

Nov 19 '05 #2
Yes, running .NET, but what I meant was I needed to get the value of the
controls in my C# program. Programatically I need to check the value of the
controls. I can't figure out how to do it through any normal object.

"Kevin Spencer" wrote:
Hi Brian,

Do you have Visual Studio.Net? If so, three are oodles of ways to inspect
process and data in your app, using BreakPoints, Watches, etc.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
I have a C# application that builds dynamic HTML and renders it. Because
it
is rendered in this way, the input controls are not server controls. I
write
the entire page, which has a variable number of detail lines for an order.
I
want the user to be able to change values on these detail lines and hit an
'update' button. I know how to do this in Javascript, but I'd like to be
able to inspect the controls that come back to my C# program during a
Postback. Since these are not server controls, they are not available in
Page.Controls. What is the 'proper' way to inspect these inside of the
compiled C# program? Right now I'm parsing them out through javascript,
and
passing them through cookies, but there has to be a better way than this,
isn't there?


Nov 19 '05 #3
When you say "running .Net," are you referring to the .Net platform, or, as
I asked, Visual Studio.Net?

In any case, the question is moot, since you want to do it programmatically.
Your best bet is to use WebControls or HtmlControls to do this. That is what
they are designed for. Any other solution is going to be problematic.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
Yes, running .NET, but what I meant was I needed to get the value of the
controls in my C# program. Programatically I need to check the value of
the
controls. I can't figure out how to do it through any normal object.

"Kevin Spencer" wrote:
Hi Brian,

Do you have Visual Studio.Net? If so, three are oodles of ways to inspect
process and data in your app, using BreakPoints, Watches, etc.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
>I have a C# application that builds dynamic HTML and renders it.
>Because
>it
> is rendered in this way, the input controls are not server controls. I
> write
> the entire page, which has a variable number of detail lines for an
> order.
> I
> want the user to be able to change values on these detail lines and hit
> an
> 'update' button. I know how to do this in Javascript, but I'd like to
> be
> able to inspect the controls that come back to my C# program during a
> Postback. Since these are not server controls, they are not available
> in
> Page.Controls. What is the 'proper' way to inspect these inside of the
> compiled C# program? Right now I'm parsing them out through
> javascript,
> and
> passing them through cookies, but there has to be a better way than
> this,
> isn't there?


Nov 19 '05 #4
Maybe I'm approaching this wrong then. My end result is to have a web page
that shows a variable number of 'detail' lines. These are pulled from a
database. I put a server control on my page that internally renders the
HTML. It builds the entire page dynamically, since the # of detail lines is
not know until the actual order is pulled up. I have checkboxes on each of
the detail lines, so that a user can check a line, and click a button to see
more detail for that line.

The problem is, that since the entire page was built with dynamic HTML, I'm
having trouble finding out which line is checked. Currently, I have a couple
of lines of java script that determine which line is checked, put the value
in a cookie, and pass that to my C# program. It just seems to me that there
should be a way in my C# program to figure out which lines are checked.
Since this whole page is built dynamically, I don't have web controls or html
controls. Any ideas?

"Kevin Spencer" wrote:
When you say "running .Net," are you referring to the .Net platform, or, as
I asked, Visual Studio.Net?

In any case, the question is moot, since you want to do it programmatically.
Your best bet is to use WebControls or HtmlControls to do this. That is what
they are designed for. Any other solution is going to be problematic.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
Yes, running .NET, but what I meant was I needed to get the value of the
controls in my C# program. Programatically I need to check the value of
the
controls. I can't figure out how to do it through any normal object.

"Kevin Spencer" wrote:
Hi Brian,

Do you have Visual Studio.Net? If so, three are oodles of ways to inspect
process and data in your app, using BreakPoints, Watches, etc.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
>I have a C# application that builds dynamic HTML and renders it.
>Because
>it
> is rendered in this way, the input controls are not server controls. I
> write
> the entire page, which has a variable number of detail lines for an
> order.
> I
> want the user to be able to change values on these detail lines and hit
> an
> 'update' button. I know how to do this in Javascript, but I'd like to
> be
> able to inspect the controls that come back to my C# program during a
> Postback. Since these are not server controls, they are not available
> in
> Page.Controls. What is the 'proper' way to inspect these inside of the
> compiled C# program? Right now I'm parsing them out through
> javascript,
> and
> passing them through cookies, but there has to be a better way than
> this,
> isn't there?


Nov 19 '05 #5
Hi Brian,

Okay, you say you "put a server control on my page that internally renders
the HTML." And "It just seems to me that there should be a way in my C#
program to figure out which lines are checked." Finally, you also mention
that you "have a couple of lines of java script that determine which line is
checked, put the value in a cookie, and pass that to my C# program." In
fact, you HAVE figured out a way in your program to figure out which lines
are checked.

Perhaps you are misunderstanding ASP.Net a bit, but you certainly know how
to solve a problem! And that is what a programmer (and a program) does. Let
me see if I can clear it up a bit for you and give you a better day.

ASP.Net is all about HTML and HTTP. What the server-side part of the app
does is to create HTML and respond to browser requests, in essence. In other
words, ASP.Net is about working in a stateless HTTP environment in which the
client is disconnected from the server, and HTML is the UI "language" if you
will. HTTP is all about messaging, sending messages back and forth between
the browser and the server.

So, in fact, an ASP.Net application has both a server-side and a client-side
aspect to it. The fact that the server-side code renders the client-side
HTML may be confusing you, but in fact, both are inseparable (although
separate) parts of the same application.

The built-in Microsoft Server Controls, as well as any custom Server
Controls you may create and/or use, do essentially what your solution does.
The only diffrence is in the methodology, and even that is similar. MS
Server Controls render both HTML and JavaScript, as JavaScript is almost the
only way to create a process on the client, in the browser. Server Controls
handle client-side events by creating and using JavaScript and hidden form
fields. The JavaScript on the client is wired up to client-side form
elements via JavaScript event handlers. When a button is clicked, for
example, a JavaScript event handler is fired that puts the ID of the button
into one hidden form field, and an "argument" or a set of arguments, if any,
into another. It then posts the form, which sends the form data, including
the event data, back to the server, where the server-side code reacts to it.

Your solution is proprietary, and doesn't follow the ASP.Net programming
model very closely, but it does essentially what the ASP.Net programming
model does. The ASP.Net programming model is more extensible, and follows a
design pattern that is extremely well thought-out. You may want to follow it
more closely in the future, but that is really of secondary importance to
solving the problem, which you have done quite well.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
Maybe I'm approaching this wrong then. My end result is to have a web
page
that shows a variable number of 'detail' lines. These are pulled from a
database. I put a server control on my page that internally renders the
HTML. It builds the entire page dynamically, since the # of detail lines
is
not know until the actual order is pulled up. I have checkboxes on each
of
the detail lines, so that a user can check a line, and click a button to
see
more detail for that line.

The problem is, that since the entire page was built with dynamic HTML,
I'm
having trouble finding out which line is checked. Currently, I have a
couple
of lines of java script that determine which line is checked, put the
value
in a cookie, and pass that to my C# program. It just seems to me that
there
should be a way in my C# program to figure out which lines are checked.
Since this whole page is built dynamically, I don't have web controls or
html
controls. Any ideas?

"Kevin Spencer" wrote:
When you say "running .Net," are you referring to the .Net platform, or,
as
I asked, Visual Studio.Net?

In any case, the question is moot, since you want to do it
programmatically.
Your best bet is to use WebControls or HtmlControls to do this. That is
what
they are designed for. Any other solution is going to be problematic.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
news:30**********************************@microsof t.com...
> Yes, running .NET, but what I meant was I needed to get the value of
> the
> controls in my C# program. Programatically I need to check the value
> of
> the
> controls. I can't figure out how to do it through any normal object.
>
> "Kevin Spencer" wrote:
>
>> Hi Brian,
>>
>> Do you have Visual Studio.Net? If so, three are oodles of ways to
>> inspect
>> process and data in your app, using BreakPoints, Watches, etc.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> Sometimes you eat the elephant.
>> Sometimes the elephant eats you.
>>
>> "Brian Kitt" <Br*******@discussions.microsoft.com> wrote in message
>> news:C5**********************************@microsof t.com...
>> >I have a C# application that builds dynamic HTML and renders it.
>> >Because
>> >it
>> > is rendered in this way, the input controls are not server controls.
>> > I
>> > write
>> > the entire page, which has a variable number of detail lines for an
>> > order.
>> > I
>> > want the user to be able to change values on these detail lines and
>> > hit
>> > an
>> > 'update' button. I know how to do this in Javascript, but I'd like
>> > to
>> > be
>> > able to inspect the controls that come back to my C# program during
>> > a
>> > Postback. Since these are not server controls, they are not
>> > available
>> > in
>> > Page.Controls. What is the 'proper' way to inspect these inside of
>> > the
>> > compiled C# program? Right now I'm parsing them out through
>> > javascript,
>> > and
>> > passing them through cookies, but there has to be a better way than
>> > this,
>> > isn't there?
>>
>>
>>


Nov 19 '05 #6

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

Similar topics

1
9599
by: Hari | last post by:
What is the difference between HTML controls, HTML server controls , ASP.Net controls? Which will give more performance?
3
1959
by: brian | last post by:
What are the advantages and disadvantages of using HTML Server Controls over Web Server Controls and vice versa? Is there a clear cut consensus among ASP.NET developers over which controls to use?...
8
2038
by: Alan Silver | last post by:
Hello, ASP.NET newbie here so please be nice ;-) I'm reading ASP.NET Unleashed, following a recommendation here. I am a little confused about the difference between HTML controls and web...
4
1307
by: Daniel Groh | last post by:
Hi, I'm newbie to ASP.Net and I'd like to know the best way and when shoul I use WebControls and HTML Controls, what is the difference ? I'm developing a login system but i don't know if i use the...
1
3394
by: Marcus | last post by:
I have a problem maybe one of you could help me with. I've created a data entry screen with lots of dynamically-created client-side controls. I create HTML texboxes client-side by assigning a...
7
1257
by: Adam Knight | last post by:
Just out of interest, what is everbody's thought on using HTML Controls Vs Web Controls. Any preferences?? Cheers, Adam
3
1571
by: Chris Davoli | last post by:
Another front end guy that I work with wants to use old HTML controls instead of the new .NET server controls. Since he is a old HTML and classic asp person and is familiar with this, he wants to...
2
1087
by: Raj Dhrolia | last post by:
Hi Everyone, I have some HTML snippets (with about 15 HTML controls) that needs to be embedded into my server control. I need these HTML controls on client side for some processing (JS). What...
1
3451
by: bradwoody | last post by:
ASP.Net and C# I am having trouble determining how to manipulate html controls via javascript AND access those same controls in the C# code behind. Here's the scoop: I am making an advanced...
0
7118
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...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7493
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...
1
5049
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...
0
4706
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...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.