Valhalla Legends Forums Archive | Web Development | [ASP .NET] Custom Controls

AuthorMessageTime
CupHead
Just as an example of what you can do with custom controls in ASP .NET, here are some screenshots of a login control I made that verifies through an Access database. The UI stuff (colors, dimensions, fonts) are all controlled via style sheet rather than hard-coded.

[img]http://cuphead.valhallalegends.com/images/loggedout.png[/img]
[img]http://cuphead.valhallalegends.com/images/loggedin.png[/img]
November 12, 2003, 8:45 PM
Adron
Is that a server-side or client-side thing? I typically associate a "control" with some type of user input thing that runs on the client and handles mouse/keyboard input + redrawing, but putting a login box client-side makes no sense..
November 12, 2003, 8:58 PM
CupHead
ASP .NET kind of blurs the line. You do the programming and it makes client-side what needs to be client-side and compiles for the server what needs to be done on the server.
November 12, 2003, 9:00 PM
Grok
It's hard to blur anything when there are exactly two computers involved. The client is running code in the browser, the server wherever the .NET CLR is running as host.

If there is only one computer involved, then you could say it is blurry.
November 12, 2003, 9:17 PM
CupHead
There is only one computer involved at the moment--mine. But the point that I was more trying to make is that you code everything at once, not necessarily writing code that is distinguishable from client or server. .NET does all of the deciding for you.
November 12, 2003, 9:24 PM
Myndfyr
Now, is that a full-fledged Custom Control, or is it just a User Control?

That's awesome if it's a full-fledged Custom Control, because with my experience, they're real bears to code, and ASP.NET does NOT decide for you what to do. You have to program all of it, whereas a User Control is managed by the runtime (the .ascx file).

Nice-looking, though. =)
November 13, 2003, 1:54 AM
Adron
[quote author=CupHead link=board=22;threadid=3568;start=0#msg28875 date=1068672299]
There is only one computer involved at the moment--mine. But the point that I was more trying to make is that you code everything at once, not necessarily writing code that is distinguishable from client or server. .NET does all of the deciding for you.
[/quote]

Doesn't that sound very much like regular scripting where you write either vbscript/javascript that runs on the server or vbscript/javascript that runs on the client? The difference would be that in regular scripting you yourself put either <% or <script> tags around your code, but I find it hard to believe that there isn't something you do to mark up what's going to be client side and what's going to be server side now anyway?
November 13, 2003, 10:54 AM
CupHead
[quote author=Adron link=board=22;threadid=3568;start=0#msg28957 date=1068720892]
Doesn't that sound very much like regular scripting where you write either vbscript/javascript that runs on the server or vbscript/javascript that runs on the client? The difference would be that in regular scripting you yourself put either <% or <script> tags around your code, but I find it hard to believe that there isn't something you do to mark up what's going to be client side and what's going to be server side now anyway?
[/quote]

The runat="server" parameter inside a tag is what lets the CLR know which code is server-side. Also, .NET code is compiled on the server as opposed to being interpreted by a scripting engine.
November 13, 2003, 1:53 PM
St0rm.iD
Basically, you can give a ListBox an onClick event and write code for it, and VB.NET knows to place the client-side onClick event on the client and the server-side handler on the server.
November 14, 2003, 1:41 AM
Adron
[quote author=St0rm.iD link=board=22;threadid=3568;start=0#msg29076 date=1068774105]
Basically, you can give a ListBox an onClick event and write code for it, and VB.NET knows to place the client-side onClick event on the client and the server-side handler on the server.
[/quote]

Does it also handle splitting
[code]
Sub OnClick
label1 = val(text1) + val(text2)
conn.execute "update table set value=" & label1
End Sub
[/code]

into one part that runs on the client updating the label, and one part that runs on the server, updating the database?
November 14, 2003, 5:47 PM
CupHead
What it would do in that situation is perform the label change server side so that after the form is submitted, the new page will have the updated label text.
November 14, 2003, 6:51 PM
Adron
[quote author=CupHead link=board=22;threadid=3568;start=0#msg29145 date=1068835868]
What it would do in that situation is perform the label change server side so that after the form is submitted, the new page will have the updated label text.
[/quote]

What if I want to do the label change client side and then submit the changed label to the server for storage?

edit:
More complex example: Think of how the "Post" button on the forum is first disabled, then the post is stored to the server. The Post button is disabled client side first, then the storage is done server side.
November 15, 2003, 6:16 PM
CupHead
That would be done via a client side script (likely JavaScript) independent of the server controls.
November 15, 2003, 7:17 PM
Adron
But didn't you say ASP.NET would do both client-side and server-side?
November 16, 2003, 12:36 AM
St0rm.iD
[quote author=Adron link=board=22;threadid=3568;start=0#msg29369 date=1068942962]
But didn't you say ASP.NET would do both client-side and server-side?
[/quote]

You can tell it what to run on the server and what on the client using the runat parameter of the listbox.
November 16, 2003, 12:42 AM
Adron
[quote author=St0rm.iD link=board=22;threadid=3568;start=0#msg29372 date=1068943361]
You can tell it what to run on the server and what on the client using the runat parameter of the listbox.
[/quote]

Of the listbox??
November 16, 2003, 12:48 AM
peofeoknight
ASP.NET its self is server side. It does not do anything client side. You can integrate it with dhtml javascript or vbscript to get some desired affects but ASP.NET is server side. Now, I am not quite clear on the problem here. Is this a problem in how it is displaying or working? If it is not looking good why not just ditch creating the html attributes and use a lil css? Now about the runat commands. If you want to use an html element do not even put the runat in there and just make the html element. To make an html element runat the server then you use runat="server". But do not try to make a <asp:listbox run at the client level, just go ahead and do that in html.
November 19, 2003, 10:19 PM
St0rm.iD
[quote author=peofeoknight link=board=22;threadid=3568;start=15#msg30167 date=1069280342]
ASP.NET its self is server side. It does not do anything client side. You can integrate it with dhtml javascript or vbscript to get some desired affects but ASP.NET is server side. Now, I am not quite clear on the problem here. Is this a problem in how it is displaying or working? If it is not looking good why not just ditch creating the html attributes and use a lil css? Now about the runat commands. If you want to use an html element do not even put the runat in there and just make the html element. To make an html element runat the server then you use runat="server". But do not try to make a <asp:listbox run at the client level, just go ahead and do that in html.
[/quote]

It runs serverside, but decides what to send to the client and how to make it interact with the server correctly.
November 19, 2003, 10:56 PM
CupHead
[quote author=peofeoknight link=board=22;threadid=3568;start=15#msg30167 date=1069280342]
ASP.NET its self is server side. It does not do anything client side. You can integrate it with dhtml javascript or vbscript to get some desired affects but ASP.NET is server side. Now, I am not quite clear on the problem here. Is this a problem in how it is displaying or working? If it is not looking good why not just ditch creating the html attributes and use a lil css? Now about the runat commands. If you want to use an html element do not even put the runat in there and just make the html element. To make an html element runat the server then you use runat="server". But do not try to make a <asp:listbox run at the client level, just go ahead and do that in html.
[/quote]

There is no problem, I was just demonstrating the ASP .NET stuff.
November 19, 2003, 11:02 PM
peofeoknight
[quote author=St0rm.iD link=board=22;threadid=3568;start=15#msg30177 date=1069282561]It runs serverside, but decides what to send to the client and how to make it interact with the server correctly.
[/quote]The server outputs html generally with a little java script from time to time. I have not seen much java script other than the required feild validators. The whole point of using a server side language for scripting is to escape client side scripting which is not as accessable and not secure. You can type raw javascript, dhtml, css etc into your asp.net files after the </script><html> tags all you want and the server is not going to screw with it at all unless you are putting in includes or <asp: elements.

Here is the only server genorated java script that is on the default page for my clan's site
<script language="javascript" src="/aspnet_client/system_web/1_1_4322/WebUIValidation.js"></script>
Its just importing the validation sontrols etc.
November 19, 2003, 11:41 PM

Search