|
Paul Riley wrote:
leppie wrote:
hopefully in ASP.NET v2, us developer wont have to write a single line of ASP code.
OK, maybe I understood it wrong, but I thought that ASP code, is embedded ASP commands and syntax within HTML, where I am purely trying to "push" everything to the client via ASP.NET in C#.
I do totally agree with you! I would prefer everything server-side exclusively.
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Sorry, I missed you point completely there, didn't I?
In that case I'm with you completely; the only code I have embedded in the HTML is databinding stuff which really does belong there. It'd be evil if you had to look back to your code to see what data was bound to what control.
Paul
|
|
|
|
|
Paul Riley wrote:
the only code I have embedded in the HTML is databinding stuff which really does belong there
I just get values from a dataset No need to even to do databinding in HTML.
Infact, Templated Databound Controls looks waaaaaaayyyyy to complicated for my needs, but it mite be usefull for the control designer (who wishes to make distributable controls). BTW, does a property need a special attribute to become databindable?
Cheers
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
leppie wrote:
I just get values from a dataset No need to even to do databinding in HTML.
Very true and I did my first site that way, but DataBinding is very powerful and can remove tons of code from the CodeBehind.
For example, if you want to build a DropDownList from a DataSet, you can run through the dataset and add the items in a loop. Or you can drop the DataSet and the DropDownList onto your page, go into the Data properties, select the dataset, the value field and the text field and you're done (except one line of code to tell it when to DataBind).
Not too much of a saving if you only have one DropDownList. But I have one page with eight DropDownLists all containing a list of players for a team, so the team can assign a captain and the 7 players.
In that scenario, I only need to drop one DataSet onto the form and I can bind all 8 DropDownLists to it. A single this.DataBind() and it's all done.
leppie wrote:
BTW, does a property need a special attribute to become databindable?
Yeah, I think it's Bindable(true). I haven't written a custom control that needs databinding as yet but it looks simple enough.
Paul
|
|
|
|
|
Paul Riley wrote:
Yeah, I think it's Bindable(true). I haven't written a custom control that needs databinding as yet but it looks simple enough.
It'll try that Thanx! Unfortunately mine is all custom rendering , basically an object and webcontrol in one. So my properties mite just need that
Cheers
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Incidentally, bound datagrids are even cooler. I have one page that needs to display a list of players in a dataset.
The first column needs to contain the name which is also a link to another page, passing the player id as a parameter.
The second column needs to contain the email address which is also a mailto: link.
The third column should be a location. It took me about 15 minutes to knock that together with the following code:
<asp:datagrid id=dgPlayer runat="server" Width="100%" DataMember="Player" DataSource="<%# dsPlayer %>" AutoGenerateColumns="False" DataKeyField="PlayerID">
<HeaderStyle Font-Bold="True"></HeaderStyle>
<Columns>
<asp:TemplateColumn ItemStyle-Width="50%">
<HeaderTemplate>
Player <i>(Click to Edit)</i>
</HeaderTemplate>
<ItemTemplate>
<a href='editplay.aspx?guid=<%# DataBinder.Eval(Container.DataItem, "PlayerID" ) %>'>
<%# DataBinder.Eval(Container.DataItem, "FullName" ) %>
</a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Width="25%">
<HeaderTemplate>
Email
</HeaderTemplate>
<ItemTemplate>
<a href='mailto:<%# DataBinder.Eval(Container.DataItem, "Email" ) %>'>
<%# DataBinder.Eval(Container.DataItem, "Email" ) %>
</a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Location" HeaderText="Location" ItemStyle-Width="25%"></asp:BoundColumn>
</Columns>
</asp:datagrid> It might have taken me a hell of a lot longer to do this using code. DataBinding does seem complicated when you first come to play with it but, like most things in .NET, once you've done it a couple of times it's great.
Paul
|
|
|
|
|
You can even just bind the data without that code, by just using the Property Builder and you get this :
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 10px; POSITION: absolute; TOP: 11px" runat="server" Width="720px" Height="247px" DataSource="<%# dataSet11 %>" DataKeyField="ID" AllowSorting="True" DataMember="Users">
</asp:DataGrid>
</form>
</body>
</HTML>
and in the page load event:
oleDbDataAdapter1.Fill(dataSet11.Users);
DataBind();
My HTML pages look similar to this. Dump one container control, and preform all the rest of tasks at server-side I must say the DtaGrid is extremely well designed, but can be a bit limiting, hence my need to have made a custom control.
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
leppie wrote:
by just using the Property Builder and you get this :
Unfortunately the <pre> tag isn't very smart when it comes to asp: tags. So I can't actually read what you've written there (I had to copy to notepad and do a few mass replaces)
leppie wrote:
I must say the DtaGrid is extremely well designed, but can be a bit limiting, hence my need to have made a custom control.
Limiting how? I haven't found anything I can't do with a datagrid yet (at least nothing that I'd want to do )
Paul
|
|
|
|
|
Paul Riley wrote:
Limiting how? I haven't found anything I can't do with a datagrid yet (at least nothing that I'd want to do )
It can only hold a row of data Sometimes you need to communicate multiple lines of info to the client if the data is too "wide" for the page. Take a very simple forum as an example. OOhh just had an idea, a forum of one-liners . I'm getting tired
CP should really have an IRC server or some chat rooms that are logged and moderated, taking useful snippets and info and adding that to a sticky FAQ thread in each forums. OK, maybe I'm just asking for wwaaayyy too much! I would assume the Lounge would be chaos.
Cheers
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
leppie wrote:
Sometimes you need to communicate multiple lines of info to the client if the data is too "wide" for the page.
Gotcha. It's true that DataBinding a DataGrid falls apart there (and it probably shouldn't - most reporting programs will let you leave a column blank if it's the same as the row before), but you can still do this easily by code. Or if you really want to databind it for some reason, just build a normal table using a DataRepeater.
The forum example in particular could be done easily using a DataRepeater.
And please, forget you even considered the chat room idea, I spend far too much time here already
Paul
|
|
|
|
|
Any one who have any idea of any IDE for for developing application for ASP??
|
|
|
|
|
Visual Interdev is cool, especially as it works nicely with SQL Server (or Access) as Microsoft built them all.
The following statement about your geekness is true. The previous statement about your geekness is false.
|
|
|
|
|
What else .. but Visual Studio;P
|
|
|
|
|
|
Hi,
if I have javascript function:
function doWork()
{
//some important work to do
}
ho can I retrieve function name and store it in variable INSIDE that function????? I tried to do this:
function doWork()
{
//some important work to do
var func_name ;
func_name = this.name ;
}
but nothing...
is this possible and how?
|
|
|
|
|
Thats an interesting problem...why do you need to do this...maybe there is another way...?
I dunno if this will work but you can try this...
So long as the function is defined as follows and not externally (i think)
<script id='test' language='jscript'>
function ExecFunc(){
alert('Do something useful');
}
</script>
You can try extracting whatever is between the script tags using document.all.test.text parse the entire text for only function names and pass the variable strings to eval function when you need them exectued...
HTH
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
<vent>
Is it me, or is the web still the last thing looked at for innovations?
I mean, really... Would it be so hard for MS to include a decent way for controls placed onto a form to be resized as the page gets resized without having to resort ot all kinds of javascript hacks?
|
|
|
|
|
Ray Cassick wrote:
Would it be so hard for MS to include a decent way for controls placed onto a form to be resized as the page gets resized without having to resort ot all kinds of javascript hacks?
You don't need JavaScript hacks Ray. Use CSS, it does it quite fine.
|
|
|
|
|
Paul Watson wrote:
You don't need JavaScript hacks Ray. Use CSS, it does it quite fine.
Ok, I'm open.. can you point me towards any examples?
Sorry for the nasty rant, but I was really kind of p*ssed that I could not use some simple VB (or C# for that matter to resize a control because aparently the page does not fire a resize event...
I thought webfroms were supposed to make things oh so much simpler... MS Finally made it easy to code windows forms that resize controls without writing any code, and I stil can't even write code on a web page in VB to do this. UGH!
|
|
|
|
|
Ray Cassick wrote:
Sorry for the nasty rant, but I was really kind of p*ssed that I could not use some simple VB (or C# for that matter to resize a control because aparently the page does not fire a resize event...
Problem is that if they do that, the entire form would need to post back to the server every time it's resized. That could be kind of annoying for the user.
Paul
|
|
|
|
|
Paul Riley wrote:
form would need to post back to the server every time it's resized
And to me THIS is the problem. WHY? Has the web not evolved enough to cause someone to sit up and take notice tothe point that this is a real design problem and address it somehow? What about a standardized client-side forms engine? And NO, I am not suggesting something as large as .NET. Just something that would allow GOOD forms to be rendered ont he client side beetter than they are now. I don;t see why the broswer could not be smart enough to understand dock and anchor tags to the extent of altering the size and location of the primatives it is displaying.
|
|
|
|
|
Sure, but then you need to convince the W3C to make this standard AND all the browser producers to follow suit. If Microsoft tried doing this, they'd be hammered again for monopolising the browser market.
Besides, even if you did somehow pull it off, for web site developers to ever use it you'd need to convince everybody (including corporations) to upgrade their browsers to a version that supports the client-side forms viewer. If companies aren't willing to upgrade (and many STILL haven't moved to IE6) then what's the point in having a great site that only half the world can use?
It's been a hard enough slog getting where we are with CSS and JavaScript, I don't see it moving on much in the near future. The future of "pretty" web sites that run purely on the client is in Flash, QuickTime, etc, etc. MS, I suspect, will concentrate on server-side development and for that .NET is a superb shift in the right direction.
Paul
|
|
|
|
|
Building a web application in ASP.Net that allows a user to perform a search. The results of the search are put into a user control. If the user performs a second search and there is no data available the app is designed to go to a second user control. This works great on my machine, problem is when I run it on the server the first user control will be pulled up and contain the first searches results. In the first two steps of the search process I set all module variables to nothing and clear the viewstate. This seems to do the job on my machine. The only difference in code between the two machines is the web.config file.
I have been working on this problem for quite some time; any help is greatly appreciated.
Jason W.
|
|
|
|
|
After additional testing I discovered that the problem exists on both machines. I need to be able to return all the variables and objects on the user controls to their original state. Is there a method that will accomplish this?
Jason W.
|
|
|
|
|
Hi again
I want to place 3 dummy objects in a containing control at design time, so it can be "previewed". I have tried the following, but it does not work...
protected override void Render(HtmlTextWriter output)
{
if (Site!=null)
{
if (Site.DesignMode)
{
for (int i = 0; i < 3; i++)
{
entrycol.Add( new Entry(this) );
}
}
}
output.WriteLine(ELEMENTSTART);
foreach (Entry entry in entrycol)
{
entry.RenderControl(output);
output.Write(SEPERATOR);
}
output.WriteLine(ELEMENTEND);
}
Now Site.DesignMode doesnt seem to work in design mode. The page works fine at runtime when I am getting data from a SQL server.
Please don't tell me to go look at TemplatedControls. I have, and it's GREEK .
Can someone please help me?
Cheers
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|