Showing posts with label basic. Show all posts
Showing posts with label basic. Show all posts

Monday, March 26, 2012

Newbie ASP.Net-- how to use external assemblies?

I think (I know) I have a basic ASP.Net question. How can I use outside
components in an ASP.Net webpage? I know how to do it in ASP--
CreateObject() or CreateInstance() with the ProgID. However, I'm not sure
of ASP.Net's prefered way of going about the same task. A register
directive, maybe? TIA for pointing me in the right direction.
-JimYour question is confusing, because your title says "external assemblies"
and your message says "outside components." Assembly is a term for a .Net
assembly, while "outside components" is a generic term that could mean
anything from a C++ DLL to a COM object to a .Net assembly (no doubt I've
omitted a few other types of components).
If it's assemblies you want to use, just put them in your app's bin folder
and reference them. How you reference them depends upon your development
environment. If not .Net assemblies, you will need to use some form of
Interop, which is not a can of worms you should really want to open, unless
you absolutely have to.
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
"Jim Bancroft" <bobgambles@.nowhere.com> wrote in message
news:eFbzt5NoEHA.3396@.tk2msftngp13.phx.gbl...
> I think (I know) I have a basic ASP.Net question. How can I use outside
> components in an ASP.Net webpage? I know how to do it in ASP--
> CreateObject() or CreateInstance() with the ProgID. However, I'm not sure
> of ASP.Net's prefered way of going about the same task. A register
> directive, maybe? TIA for pointing me in the right direction.
> -Jim
>
Ok, I wasn't completely clear-- I've written a DLL in VB .Net, and I'd like
to access the contained components/objects from my ASP.Net pages. No
interop needed here. Could someone let me know how to go about accessing my
.Net components from within ASP.Net? Thanks again,
-Jim
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:Oh%23MbZOoEHA.3460@.TK2MSFTNGP15.phx.gbl...
> Your question is confusing, because your title says "external assemblies"
> and your message says "outside components." Assembly is a term for a .Net
> assembly, while "outside components" is a generic term that could mean
> anything from a C++ DLL to a COM object to a .Net assembly (no doubt I've
> omitted a few other types of components).
> If it's assemblies you want to use, just put them in your app's bin folder
> and reference them. How you reference them depends upon your development
> environment. If not .Net assemblies, you will need to use some form of
> Interop, which is not a can of worms you should really want to open,
unless
> you absolutely have to.
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> I get paid good money to
> solve puzzles for a living
In Visual Studio under your project right click on references --> Add
Reference. You'll be presented with a dialog box and already on the .Net tab
(which contains a list of assemblies registered in the GAC). Click the brows
e
button and select the .Net DLL that you want to reference. Click Ok and voil
a
- you can now reference the classes exposed by that DLL in your web app.
-Demetri
"Jim Bancroft" wrote:

> Ok, I wasn't completely clear-- I've written a DLL in VB .Net, and I'd lik
e
> to access the contained components/objects from my ASP.Net pages. No
> interop needed here. Could someone let me know how to go about accessing
my
> ..Net components from within ASP.Net? Thanks again,
> -Jim
>
> "Kevin Spencer" <kspencer@.takempis.com> wrote in message
> news:Oh%23MbZOoEHA.3460@.TK2MSFTNGP15.phx.gbl...
> unless
>
>
Again, it depends upon your development environment. What would that be?
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
"Jim Bancroft" <bobgambles@.nowhere.com> wrote in message
news:eOIsM7OoEHA.2900@.TK2MSFTNGP12.phx.gbl...
> Ok, I wasn't completely clear-- I've written a DLL in VB .Net, and I'd
like
> to access the contained components/objects from my ASP.Net pages. No
> interop needed here. Could someone let me know how to go about accessing
my
> .Net components from within ASP.Net? Thanks again,
> -Jim
>
> "Kevin Spencer" <kspencer@.takempis.com> wrote in message
> news:Oh%23MbZOoEHA.3460@.TK2MSFTNGP15.phx.gbl...
assemblies"
.Net
I've
folder
> unless
>
Thanks, Demetri!
-Jim
"Demetri" <Demetri@.discussions.microsoft.com> wrote in message
news:C4E35F5B-3542-43A4-ADBE-857AF80CE8E7@.microsoft.com...
> In Visual Studio under your project right click on references --> Add
> Reference. You'll be presented with a dialog box and already on the .Net
tab
> (which contains a list of assemblies registered in the GAC). Click the
browse
> button and select the .Net DLL that you want to reference. Click Ok and
voila
> - you can now reference the classes exposed by that DLL in your web app.
> -Demetri
>

Saturday, March 24, 2012

Newbie Form Question

I have written my first asp.net form that has some very basic input fields. I am able to retrieve the user input using c# as my code behind. On this event I retrieve input from user.

private void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Reciprocal link: " + reciplink.Text);
Response.Write("<br>");
Response.Write("Customer website: " + custurl.Text);
Response.Write("<br>");
Response.Write("Customer title: " + custtitle.Text);

}

Problem is that when I display these values on the web page the input boxes and original form are still there. So the values are be written on top of the previous form. How do you clear the contents of the web page so that when the end user clicks a submit button they see ONLY the values they entered. Do you spawn a new page or ?One thing you can do is set the Visible property of web controls to false.

reciplink.Visible = false;
custurl.Visible = false;
custtitle.Visible = false;
Hi,

using response.write is not such a good idea to show information to your users because it writes everything before the opening html tag.

Rather use a label control or literal control for this and set the Text property.

I cooked up a little piece of code to demonstrate what I mean:

Some extra information: I placed the textbox and button control in a panel control so I only have to set the visibility of this 1 control instead of setting this property of every control (I'm on vacation right now so I'm a bit lazy ;-) ).


<%@. Page Language="C#" %>
<script runat="server"
void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Your input was: " + TextBox1.Text.Trim();
Panel1.Visible = false;

Response.Write(Label1.Text);
}

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:Panel id="Panel1" runat="server">
<p>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
</p>
<p>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>
</p>
</asp:Panel>
</p>
<p>
<asp:Label id="Label1" runat="server"></asp:Label>
</p>
</form>
</body>
</html>

When you take a look at the rendered page source in your browser (view | Source) you'll see the text "Your input was: ..." appear on the first line in the html by this breaking the code. This comes from the response.write. It used to be a mechanism in classic asp but nowadays we havetracing for that.

Grz, Kris.
Thanks for your response. I do not understand where you are writing the variable to page. Obviously I get the response.write but using the panel I still do not get it. I have played around and can see how placing objects on one panel and then setting it to false will remove all the input boxes. But how are you returning data to the browser without a response statement??

Also this statement:
<asp:Label id="Label1" runat="server"></asp:Label
Is this essentially just initializing a variable so that you can use it in the c# function?

When I run my code using your suggestion the panel does disappear but I do not get any out put like yours?

this is what I am using:

private void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Your input was: " + TextBox1.Text.Trim();
Panel1.Visible = false;
}
AsP.Net is event driven and object oriented - - in any given event, you assign text to the text property of a label (an object) - - that, in turn, is displayed on the screen.

your label isn't inside the panel is it?

if you make the panel invisible and the label's inside the panel, the label will be invisible also.
Something like this: (im using a codebehind page for everything i do)

test.aspx


<%@. Page language="c#" src="http://pics.10026.com/?src=test.aspx.cs" AutoEventWireup="true" Inherits="xtest.test" %>
<HTML>
<HEAD>
<title>Test</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:panel id="InputFields" runat="server" Visible="false">
<P>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox></P>
<P>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button></P>
</asp:panel><asp:panel id="Result" runat="server" Visible="false">
<P>
<asp:Label id="Label1" runat="server"></asp:Label></P>
</asp:panel></form>
</body>
</HTML>

test.aspx.cs


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace xtest
{
public class test : System.Web.UI.Page
{

protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Panel InputFields;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Panel Result;

private void Page_Load(object sender, System.EventArgs e)
{
if ( ! Page.IsPostBack )
{
InputFields.Visible = true;
Result.Visible = false;
}
}

public void Button1_Click(object sender, System.EventArgs e)
{
InputFields.Visible = false;
Result.Visible = true;

Label1.Text = TextBox1.Text.Trim();
}
}
}


That's it. I had the label inside the panel, duh! Thanks. From a best practices standpoint, would you recommend using web controls on a panel as above for most of your user input pages? In turn you could place multiple panels on a particluar page for more flexibility etc?
Hi,

you can place multiple panels on your page or you could use user controls or create your own composite controls.

That's just the big advantage and sometimes even the big disadvantage of ASP.NET: you've got a lot of freedom to do what you want to do. And just like a kid that needs to learn responsibility a developer using ASP.NET needs some time to find out which methodolgy is the best way for solving a particular problem.

Grz, Kris.

Newbie Help -- .net and static HTML

Whew... hopefully my questions will get more elaborate as I use this more... this is probably as basic as I could get.
I come from a web design background... haven't done web programmingbefore barring some CFML. Now I'm responsible for coming up to speed onASP.net + VB for work needs...
So here's my basic question.
I created a graphical HTML header for a website I'm building. Iwant to make this a global header across the application, so I want tocall it in each time a page loads. Also, I have navigationbuttons that I want to be able to program VB behind to perform certainactions (mostly just page loads). I really don't know how to addthis header to my web application so as to be able to call it in...once its created, Im confident I can muddle through creating objectsfrom the buttons and programming the VB behind them that I need.
I just frankly can't figure out how to integrate the HTML header (and graphics) with the web application.
Can anyone enlighten me? I couldnt' find an article here about that, so I'm posting.
Thanks so much!
Welcome to Asp.net!
ASP.NEt provides you with the capability to create user controls. UserControls is just like a page but it does not contain the form tag. UserControls are used to divide the pages into small sections so that pageis easy to modify in the future.
So, in your case you can make a user control for the header, footer.Once the user control is created you can simply place it (Drag andDrop) on the page and thats it. Your user control can be placed in allthe pages you have. If later you want to change something in the headersection of the page you simply change the user control and thats it.Once the user control is changed it will take effect on all the pagesthat contain it.
A good tutorial isExtensive Examination of User Controls.


That's pretty much what I needed to know, thanks very much =)
I'll check out that tutorial right now. Thanks again!

Thursday, March 22, 2012

Newbie layout question please help

I am new to ASP.NET, but not to ASP or Visual Basic.
I have read much of ASP.NET unleashed first addition. It all looks neat,
but I don't understand several things.

One thing in particular is that I laid out all of my controls on a form that
took a long time to set up--lots of fields. I did this with grid layout on.
So this makes absolute positioning, which is cool, but..

* If the user changes the browser text size the text overruns other items
* There is no way it seems to use a validation summary control or add
includeheaders to the top because it won't move the page down.

Am I missing something?

Do most people use the grid layout or not?

If I should use flow layout instead, then do I need to use tables and such
or does the IDE make them for me?

Also if I should have used flow layout, then how do I convert my existing
form to flow layout so that it will move it down for things above like the
validationsummary, etc.?

Are usercontrols, etc only good if you are in flow mode?

Please give me a general overview of this and how I should go about it.

Thanks,

ShaneI dislike grid layout.

The biggest problem, is that if you have dynamicly sized controls (e.g a
grid), you can't know in advance how much space you may need for it. A grid
may have 3 rows or 30. How do you know where to put the controls that are
supposed to go underneath it?

Another thing is that IE has issues with properly interpreting absolute
positioning under certain conditions.

To get proper layout, you can use tables, or whatever elements you require
to create your page.

To convert what you have now, change the form to FlowLayous. You will have
to redrag all your controls, in order for them to lose all the absolute
positioning information. So just select a control, and drag it elsewhere on
the form - that should do it. Alternatively, you can switch to HTML view,
and delete everything in they 'style' attribute of each control that refers
to its position.

"SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
mail> wrote in message news:upOqcJrVDHA.2896@.tk2msftngp13.phx.gbl...
> I am new to ASP.NET, but not to ASP or Visual Basic.
> I have read much of ASP.NET unleashed first addition. It all looks neat,
> but I don't understand several things.
> One thing in particular is that I laid out all of my controls on a form
that
> took a long time to set up--lots of fields. I did this with grid layout
on.
> So this makes absolute positioning, which is cool, but..
> * If the user changes the browser text size the text overruns other items
> * There is no way it seems to use a validation summary control or add
> includeheaders to the top because it won't move the page down.
> Am I missing something?
> Do most people use the grid layout or not?
> If I should use flow layout instead, then do I need to use tables and such
> or does the IDE make them for me?
> Also if I should have used flow layout, then how do I convert my existing
> form to flow layout so that it will move it down for things above like the
> validationsummary, etc.?
> Are usercontrols, etc only good if you are in flow mode?
> Please give me a general overview of this and how I should go about it.
> Thanks,
> Shane
I only use flow layout. Grid layout can be a real bear to work with and
absolute positioning is very tricky and not supported in older browsers.
The resizing thing you've discovered is another pain.

To convert to flow layout, just change the pageLayout property. I've
found that you sometimes need to slightly move each control after you
make the change to get it to snap to the new layout.

You'll need tables to align everything, just like in plain old HTML.

HTH
Barry

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Thanks--my problems exactly,
but you could you explain to me if I should use panels or placeholders and
exatly what those are and how they work...

I am still vague on it all.

Thanks for everything...

Shane

"Marina" <zlatkinam@.nospam.hotmail.com> wrote in message
news:#zj44GsVDHA.2328@.TK2MSFTNGP12.phx.gbl...
> I dislike grid layout.
> The biggest problem, is that if you have dynamicly sized controls (e.g a
> grid), you can't know in advance how much space you may need for it. A
grid
> may have 3 rows or 30. How do you know where to put the controls that are
> supposed to go underneath it?
> Another thing is that IE has issues with properly interpreting absolute
> positioning under certain conditions.
> To get proper layout, you can use tables, or whatever elements you require
> to create your page.
> To convert what you have now, change the form to FlowLayous. You will
have
> to redrag all your controls, in order for them to lose all the absolute
> positioning information. So just select a control, and drag it elsewhere
on
> the form - that should do it. Alternatively, you can switch to HTML view,
> and delete everything in they 'style' attribute of each control that
refers
> to its position.
> "SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
> mail> wrote in message news:upOqcJrVDHA.2896@.tk2msftngp13.phx.gbl...
> > I am new to ASP.NET, but not to ASP or Visual Basic.
> > I have read much of ASP.NET unleashed first addition. It all looks
neat,
> > but I don't understand several things.
> > One thing in particular is that I laid out all of my controls on a form
> that
> > took a long time to set up--lots of fields. I did this with grid layout
> on.
> > So this makes absolute positioning, which is cool, but..
> > * If the user changes the browser text size the text overruns other
items
> > * There is no way it seems to use a validation summary control or add
> > includeheaders to the top because it won't move the page down.
> > Am I missing something?
> > Do most people use the grid layout or not?
> > If I should use flow layout instead, then do I need to use tables and
such
> > or does the IDE make them for me?
> > Also if I should have used flow layout, then how do I convert my
existing
> > form to flow layout so that it will move it down for things above like
the
> > validationsummary, etc.?
> > Are usercontrols, etc only good if you are in flow mode?
> > Please give me a general overview of this and how I should go about it.
> > Thanks,
> > Shane
Then what do you do to account for the issues I described below or do you
just not care if the user changes browser text size to Larger and everything
overlaps?

Why would anyone ever use grid layout if there is no flexibility of
flow--like growing and shrinking.
You couldn't use the validation summary control in this fashion or an
include at the top right?
Or do most people use frames to get around the header include issue?

I was wondering do sites like gotnet.com use grid layout or flowlayout to do
the neat stuff they have there?

I am also unclear on Panel and Placeholder controls--when do I use them and
how are they affected by the grid layout--I imagine they wouldn't grow or
shrink correctly.

Thanks in Advance,

Shane

"Kevin Spencer" <kevin@.takempis.com> wrote in message
news:#Y9CDnrVDHA.3332@.tk2msftngp13.phx.gbl...
> The only difference is that grid layout uses absolute positioning (via
CSS),
> and flow layout does not.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> Complex things are made up of
> lots of simple things.
> "SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
> mail> wrote in message news:upOqcJrVDHA.2896@.tk2msftngp13.phx.gbl...
> > I am new to ASP.NET, but not to ASP or Visual Basic.
> > I have read much of ASP.NET unleashed first addition. It all looks
neat,
> > but I don't understand several things.
> > One thing in particular is that I laid out all of my controls on a form
> that
> > took a long time to set up--lots of fields. I did this with grid layout
> on.
> > So this makes absolute positioning, which is cool, but..
> > * If the user changes the browser text size the text overruns other
items
> > * There is no way it seems to use a validation summary control or add
> > includeheaders to the top because it won't move the page down.
> > Am I missing something?
> > Do most people use the grid layout or not?
> > If I should use flow layout instead, then do I need to use tables and
such
> > or does the IDE make them for me?
> > Also if I should have used flow layout, then how do I convert my
existing
> > form to flow layout so that it will move it down for things above like
the
> > validationsummary, etc.?
> > Are usercontrols, etc only good if you are in flow mode?
> > Please give me a general overview of this and how I should go about it.
> > Thanks,
> > Shane
Thanks Barry.

I am still wondering about Panel and Placeholder controls--do I just use
those in flow mode?

Also while I have someone to ask is there a simple way to reset tab order in
webforms--like there is in Win Forms?
I was having to go through one control after another--yuk.

Thanks in advance,

"Barry" <barrygilbert@.nospam.com> wrote in message
news:On1IaasVDHA.484@.TK2MSFTNGP09.phx.gbl...
> I only use flow layout. Grid layout can be a real bear to work with and
> absolute positioning is very tricky and not supported in older browsers.
> The resizing thing you've discovered is another pain.
> To convert to flow layout, just change the pageLayout property. I've
> found that you sometimes need to slightly move each control after you
> make the change to get it to snap to the new layout.
> You'll need tables to align everything, just like in plain old HTML.
> HTH
> Barry
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Both panels and placeholders aren't directly related to which type of layout
you want. They can be used in both for the same purpose.

Panels are basically used for grouping controls. That way if you want to
make a group of controls invisible, you can make the panel they are in
invisible, thus making everything inside it invisible. A Panel basically is
a 'div' tag once rendered in HTML.

A placeholder can be handy when you need to dynamically load controls into
specific locations.
For example, if you need to add a textbox at runtime, but you don't want to
add it to end of the Controls collection - but in a specific location in the
middle of the page. By adding it to the Controls collection of a
placeholder - you are basically just putting your textbox in the place
holder's place. The placeholder may have multiple controls in it.

But again, neitehr of these controls are directly related to the layout type
of the page.

"SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
mail> wrote in message news:OGABAbsVDHA.1832@.TK2MSFTNGP09.phx.gbl...
> Thanks--my problems exactly,
> but you could you explain to me if I should use panels or placeholders and
> exatly what those are and how they work...
> I am still vague on it all.
> Thanks for everything...
> Shane
> "Marina" <zlatkinam@.nospam.hotmail.com> wrote in message
> news:#zj44GsVDHA.2328@.TK2MSFTNGP12.phx.gbl...
> > I dislike grid layout.
> > The biggest problem, is that if you have dynamicly sized controls (e.g a
> > grid), you can't know in advance how much space you may need for it. A
> grid
> > may have 3 rows or 30. How do you know where to put the controls that
are
> > supposed to go underneath it?
> > Another thing is that IE has issues with properly interpreting absolute
> > positioning under certain conditions.
> > To get proper layout, you can use tables, or whatever elements you
require
> > to create your page.
> > To convert what you have now, change the form to FlowLayous. You will
> have
> > to redrag all your controls, in order for them to lose all the absolute
> > positioning information. So just select a control, and drag it
elsewhere
> on
> > the form - that should do it. Alternatively, you can switch to HTML
view,
> > and delete everything in they 'style' attribute of each control that
> refers
> > to its position.
> > "SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
> > mail> wrote in message news:upOqcJrVDHA.2896@.tk2msftngp13.phx.gbl...
> > > I am new to ASP.NET, but not to ASP or Visual Basic.
> > > I have read much of ASP.NET unleashed first addition. It all looks
> neat,
> > > but I don't understand several things.
> > > > One thing in particular is that I laid out all of my controls on a
form
> > that
> > > took a long time to set up--lots of fields. I did this with grid
layout
> > on.
> > > So this makes absolute positioning, which is cool, but..
> > > > * If the user changes the browser text size the text overruns other
> items
> > > * There is no way it seems to use a validation summary control or add
> > > includeheaders to the top because it won't move the page down.
> > > > Am I missing something?
> > > > Do most people use the grid layout or not?
> > > > If I should use flow layout instead, then do I need to use tables and
> such
> > > or does the IDE make them for me?
> > > > Also if I should have used flow layout, then how do I convert my
> existing
> > > form to flow layout so that it will move it down for things above like
> the
> > > validationsummary, etc.?
> > > > Are usercontrols, etc only good if you are in flow mode?
> > > > Please give me a general overview of this and how I should go about
it.
> > > > Thanks,
> > > > Shane
> >
Thanks Marina,

But if I put a panel on a grid layout and then hide--won't it still take up
the same amout of space and the other controls still be in there place??
i.e--leave a big empty hole... Thus making flow layout necessary?

Shane

"Marina" <zlatkinam@.nospam.hotmail.com> wrote in message
news:Of$qmlsVDHA.3376@.tk2msftngp13.phx.gbl...
> Both panels and placeholders aren't directly related to which type of
layout
> you want. They can be used in both for the same purpose.
> Panels are basically used for grouping controls. That way if you want to
> make a group of controls invisible, you can make the panel they are in
> invisible, thus making everything inside it invisible. A Panel basically
is
> a 'div' tag once rendered in HTML.
> A placeholder can be handy when you need to dynamically load controls into
> specific locations.
> For example, if you need to add a textbox at runtime, but you don't want
to
> add it to end of the Controls collection - but in a specific location in
the
> middle of the page. By adding it to the Controls collection of a
> placeholder - you are basically just putting your textbox in the place
> holder's place. The placeholder may have multiple controls in it.
> But again, neitehr of these controls are directly related to the layout
type
> of the page.
> "SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
> mail> wrote in message news:OGABAbsVDHA.1832@.TK2MSFTNGP09.phx.gbl...
> > Thanks--my problems exactly,
> > but you could you explain to me if I should use panels or placeholders
and
> > exatly what those are and how they work...
> > I am still vague on it all.
> > Thanks for everything...
> > Shane
> > "Marina" <zlatkinam@.nospam.hotmail.com> wrote in message
> > news:#zj44GsVDHA.2328@.TK2MSFTNGP12.phx.gbl...
> > > I dislike grid layout.
> > > > The biggest problem, is that if you have dynamicly sized controls (e.g
a
> > > grid), you can't know in advance how much space you may need for it. A
> > grid
> > > may have 3 rows or 30. How do you know where to put the controls that
> are
> > > supposed to go underneath it?
> > > > Another thing is that IE has issues with properly interpreting
absolute
> > > positioning under certain conditions.
> > > > To get proper layout, you can use tables, or whatever elements you
> require
> > > to create your page.
> > > > To convert what you have now, change the form to FlowLayous. You will
> > have
> > > to redrag all your controls, in order for them to lose all the
absolute
> > > positioning information. So just select a control, and drag it
> elsewhere
> > on
> > > the form - that should do it. Alternatively, you can switch to HTML
> view,
> > > and delete everything in they 'style' attribute of each control that
> > refers
> > > to its position.
> > > > "SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send
me
> > > mail> wrote in message news:upOqcJrVDHA.2896@.tk2msftngp13.phx.gbl...
> > > > I am new to ASP.NET, but not to ASP or Visual Basic.
> > > > I have read much of ASP.NET unleashed first addition. It all looks
> > neat,
> > > > but I don't understand several things.
> > > > > > One thing in particular is that I laid out all of my controls on a
> form
> > > that
> > > > took a long time to set up--lots of fields. I did this with grid
> layout
> > > on.
> > > > So this makes absolute positioning, which is cool, but..
> > > > > > * If the user changes the browser text size the text overruns other
> > items
> > > > * There is no way it seems to use a validation summary control or
add
> > > > includeheaders to the top because it won't move the page down.
> > > > > > Am I missing something?
> > > > > > Do most people use the grid layout or not?
> > > > > > If I should use flow layout instead, then do I need to use tables
and
> > such
> > > > or does the IDE make them for me?
> > > > > > Also if I should have used flow layout, then how do I convert my
> > existing
> > > > form to flow layout so that it will move it down for things above
like
> > the
> > > > validationsummary, etc.?
> > > > > > Are usercontrols, etc only good if you are in flow mode?
> > > > > > Please give me a general overview of this and how I should go about
> it.
> > > > > > Thanks,
> > > > > > Shane
> > > > > >
Marina,

I seem to have problems with a very long, form.. It is nicely formating
using the grid layout.
Putting it into table mode would be a lot of reworking

For example, it is setup more like an adobe acrobat form

has fields and above each field, what is in the field. At present it is
nicely aligned unless someone decided to make their browser text bigger than
medium.

I wanted to move it all down, but there seems to be no easy way to do that
in the IDE.
I don't know how to get nice positioning without abs. positioning, but don'
t know how to get it flowing right with it.
I think maybe some pages benifit from grid layout--forms for example, and
other's don't..

Still trying to catch on. I have tried panels. I tried to just copy from
the form and past into a panel , but no luck.

Thanks...

Looks like there would be a site dealing with such issues...instead of just
code issues.

"Marina" <zlatkinam@.nospam.hotmail.com> wrote in message
news:Of$qmlsVDHA.3376@.tk2msftngp13.phx.gbl...
> Both panels and placeholders aren't directly related to which type of
layout
> you want. They can be used in both for the same purpose.
> Panels are basically used for grouping controls. That way if you want to
> make a group of controls invisible, you can make the panel they are in
> invisible, thus making everything inside it invisible. A Panel basically
is
> a 'div' tag once rendered in HTML.
> A placeholder can be handy when you need to dynamically load controls into
> specific locations.
> For example, if you need to add a textbox at runtime, but you don't want
to
> add it to end of the Controls collection - but in a specific location in
the
> middle of the page. By adding it to the Controls collection of a
> placeholder - you are basically just putting your textbox in the place
> holder's place. The placeholder may have multiple controls in it.
> But again, neitehr of these controls are directly related to the layout
type
> of the page.
> "SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send me
> mail> wrote in message news:OGABAbsVDHA.1832@.TK2MSFTNGP09.phx.gbl...
> > Thanks--my problems exactly,
> > but you could you explain to me if I should use panels or placeholders
and
> > exatly what those are and how they work...
> > I am still vague on it all.
> > Thanks for everything...
> > Shane
> > "Marina" <zlatkinam@.nospam.hotmail.com> wrote in message
> > news:#zj44GsVDHA.2328@.TK2MSFTNGP12.phx.gbl...
> > > I dislike grid layout.
> > > > The biggest problem, is that if you have dynamicly sized controls (e.g
a
> > > grid), you can't know in advance how much space you may need for it. A
> > grid
> > > may have 3 rows or 30. How do you know where to put the controls that
> are
> > > supposed to go underneath it?
> > > > Another thing is that IE has issues with properly interpreting
absolute
> > > positioning under certain conditions.
> > > > To get proper layout, you can use tables, or whatever elements you
> require
> > > to create your page.
> > > > To convert what you have now, change the form to FlowLayous. You will
> > have
> > > to redrag all your controls, in order for them to lose all the
absolute
> > > positioning information. So just select a control, and drag it
> elsewhere
> > on
> > > the form - that should do it. Alternatively, you can switch to HTML
> view,
> > > and delete everything in they 'style' attribute of each control that
> > refers
> > > to its position.
> > > > "SStory >" <Shane_Story@.online.msn.com <remove the 'online.' to send
me
> > > mail> wrote in message news:upOqcJrVDHA.2896@.tk2msftngp13.phx.gbl...
> > > > I am new to ASP.NET, but not to ASP or Visual Basic.
> > > > I have read much of ASP.NET unleashed first addition. It all looks
> > neat,
> > > > but I don't understand several things.
> > > > > > One thing in particular is that I laid out all of my controls on a
> form
> > > that
> > > > took a long time to set up--lots of fields. I did this with grid
> layout
> > > on.
> > > > So this makes absolute positioning, which is cool, but..
> > > > > > * If the user changes the browser text size the text overruns other
> > items
> > > > * There is no way it seems to use a validation summary control or
add
> > > > includeheaders to the top because it won't move the page down.
> > > > > > Am I missing something?
> > > > > > Do most people use the grid layout or not?
> > > > > > If I should use flow layout instead, then do I need to use tables
and
> > such
> > > > or does the IDE make them for me?
> > > > > > Also if I should have used flow layout, then how do I convert my
> > existing
> > > > form to flow layout so that it will move it down for things above
like
> > the
> > > > validationsummary, etc.?
> > > > > > Are usercontrols, etc only good if you are in flow mode?
> > > > > > Please give me a general overview of this and how I should go about
> it.
> > > > > > Thanks,
> > > > > > Shane
> > > > > >

Friday, March 16, 2012

Newbie needing help with a simple ASP.NET <table> problem...!

Hello, I'm hoping someone can help me out with a very basic problem
that's got me tearing my hair out! I'm wanting to have a repeater that
adds some rows to a table as below:

<asp:Repeater ID="repeater1" runat="server">

<HeaderTemplate>
<table id="table1" runat="server">
<tr>{header code goes here}</tr>
</HeaderTemplate>

<ItemTemplate>
<tr><td>
<asp:DropDownList ID="ddl1" runat="server">{drop-down list code goes
here}</asp:DropDownList>
</td></tr>
</ItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

1. However, because of the 'runat="server"' in the table tag, this
throws an 'Unexpected end of file looking for </HeaderTemplatetag'
error.

2. Removing the 'runat="server"' means that the code DOES compile -
however it seems to have the effect that whenever I try to do anything
with my drop-down list in the page-behind vb gives me a 'Object
reference not set to an instance of an object' error (not a problem
with the way I'm coding because the same line works fine in the vb if
the drop-down list is placed OUTSIDE of the table).

3. Also, the only other way I can think of to do this, to use an
<asp:tableinstead (which was actually my preferred choice if I could
have got it working) gives a 'Server elements cannot span templates'
error.

Aaargghhh! There MUST be some way of having a repeater in a table as
above, AND allow server controls (that are actually useable) within
it. Can anyone help, as my head is sore from banging it against the
wall so much!

Many, many thanks indeed.Are you sure it's an error? I use this technique all the time, it does flag
up as a *warning*, but just ignore it.

<mj.redfox.mj@dotnet.itags.org.gmail.comwrote in message
news:1172763165.984403.148440@dotnet.itags.org.z35g2000cwz.googlegr oups.com...

Quote:

Originally Posted by

Hello, I'm hoping someone can help me out with a very basic problem
that's got me tearing my hair out! I'm wanting to have a repeater that
adds some rows to a table as below:
>
>
<asp:Repeater ID="repeater1" runat="server">
>
<HeaderTemplate>
<table id="table1" runat="server">
<tr>{header code goes here}</tr>
</HeaderTemplate>
>
<ItemTemplate>
<tr><td>
<asp:DropDownList ID="ddl1" runat="server">{drop-down list code goes
here}</asp:DropDownList>
</td></tr>
</ItemTemplate>
>
<FooterTemplate>
</table>
</FooterTemplate>
>
>
1. However, because of the 'runat="server"' in the table tag, this
throws an 'Unexpected end of file looking for </HeaderTemplatetag'
error.
>
2. Removing the 'runat="server"' means that the code DOES compile -
however it seems to have the effect that whenever I try to do anything
with my drop-down list in the page-behind vb gives me a 'Object
reference not set to an instance of an object' error (not a problem
with the way I'm coding because the same line works fine in the vb if
the drop-down list is placed OUTSIDE of the table).
>
3. Also, the only other way I can think of to do this, to use an
<asp:tableinstead (which was actually my preferred choice if I could
have got it working) gives a 'Server elements cannot span templates'
error.
>
>
Aaargghhh! There MUST be some way of having a repeater in a table as
above, AND allow server controls (that are actually useable) within
it. Can anyone help, as my head is sore from banging it against the
wall so much!
>
Many, many thanks indeed.
>


Hi Aidy,

Thanks for replying. Can I just ask which of the three techniques you
use...
1. <asp:table>
2. <table>
or
3. <table runat = "server">?

On 1 Mar, 15:54, "Aidy" <a...@dotnet.itags.org.noemail.xxxa.comwrote:

Quote:

Originally Posted by

Are you sure it's an error? I use this technique all the time, it does flag
up as a *warning*, but just ignore it.
>
<mj.redfox...@dotnet.itags.org.gmail.comwrote in message
>
news:1172763165.984403.148440@dotnet.itags.org.z35g2000cwz.googlegr oups.com...
>
>
>

Quote:

Originally Posted by

Hello, I'm hoping someone can help me out with a very basic problem
that's got me tearing my hair out! I'm wanting to have a repeater that
adds some rows to a table as below:


>

Quote:

Originally Posted by

<asp:Repeater ID="repeater1" runat="server">


>

Quote:

Originally Posted by

<HeaderTemplate>
<table id="table1" runat="server">
<tr>{header code goes here}</tr>
</HeaderTemplate>


>

Quote:

Originally Posted by

<ItemTemplate>
<tr><td>
<asp:DropDownList ID="ddl1" runat="server">{drop-down list code goes
here}</asp:DropDownList>
</td></tr>
</ItemTemplate>


>

Quote:

Originally Posted by

<FooterTemplate>
</table>
</FooterTemplate>


>

Quote:

Originally Posted by

1. However, because of the 'runat="server"' in the table tag, this
throws an 'Unexpected end of file looking for </HeaderTemplatetag'
error.


>

Quote:

Originally Posted by

2. Removing the 'runat="server"' means that the code DOES compile -
however it seems to have the effect that whenever I try to do anything
with my drop-down list in the page-behind vb gives me a 'Object
reference not set to an instance of an object' error (not a problem
with the way I'm coding because the same line works fine in the vb if
the drop-down list is placed OUTSIDE of the table).


>

Quote:

Originally Posted by

3. Also, the only other way I can think of to do this, to use an
<asp:tableinstead (which was actually my preferred choice if I could
have got it working) gives a 'Server elements cannot span templates'
error.


>

Quote:

Originally Posted by

Aaargghhh! There MUST be some way of having a repeater in a table as
above, AND allow server controls (that are actually useable) within
it. Can anyone help, as my head is sore from banging it against the
wall so much!


>

Quote:

Originally Posted by

Many, many thanks indeed.- Hide quoted text -


>
- Show quoted text -


I use the repeater;

<HeaderTemplate>
<table>
</HeaderTemplate>

<ItemTemplate>
<tr>

</tr>
</ItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

<mj.redfox.mj@dotnet.itags.org.gmail.comwrote in message
news:1172764802.765456.68170@dotnet.itags.org.h3g2000cwc.googlegrou ps.com...

Quote:

Originally Posted by

Hi Aidy,
>
Thanks for replying. Can I just ask which of the three techniques you
use...
1. <asp:table>
2. <table>
or
3. <table runat = "server">?
>
On 1 Mar, 15:54, "Aidy" <a...@dotnet.itags.org.noemail.xxxa.comwrote:

Quote:

Originally Posted by

>Are you sure it's an error? I use this technique all the time, it does
>flag
>up as a *warning*, but just ignore it.
>>
><mj.redfox...@dotnet.itags.org.gmail.comwrote in message
>>
>news:1172763165.984403.148440@dotnet.itags.org.z35g2000cwz.googlegr oups.com...
>>
>>
>>

Quote:

Originally Posted by

Hello, I'm hoping someone can help me out with a very basic problem
that's got me tearing my hair out! I'm wanting to have a repeater that
adds some rows to a table as below:


>>

Quote:

Originally Posted by

<asp:Repeater ID="repeater1" runat="server">


>>

Quote:

Originally Posted by

<HeaderTemplate>
<table id="table1" runat="server">
<tr>{header code goes here}</tr>
</HeaderTemplate>


>>

Quote:

Originally Posted by

<ItemTemplate>
<tr><td>
<asp:DropDownList ID="ddl1" runat="server">{drop-down list code goes
here}</asp:DropDownList>
</td></tr>
</ItemTemplate>


>>

Quote:

Originally Posted by

<FooterTemplate>
</table>
</FooterTemplate>


>>

Quote:

Originally Posted by

1. However, because of the 'runat="server"' in the table tag, this
throws an 'Unexpected end of file looking for </HeaderTemplatetag'
error.


>>

Quote:

Originally Posted by

2. Removing the 'runat="server"' means that the code DOES compile -
however it seems to have the effect that whenever I try to do anything
with my drop-down list in the page-behind vb gives me a 'Object
reference not set to an instance of an object' error (not a problem
with the way I'm coding because the same line works fine in the vb if
the drop-down list is placed OUTSIDE of the table).


>>

Quote:

Originally Posted by

3. Also, the only other way I can think of to do this, to use an
<asp:tableinstead (which was actually my preferred choice if I could
have got it working) gives a 'Server elements cannot span templates'
error.


>>

Quote:

Originally Posted by

Aaargghhh! There MUST be some way of having a repeater in a table as
above, AND allow server controls (that are actually useable) within
it. Can anyone help, as my head is sore from banging it against the
wall so much!


>>

Quote:

Originally Posted by

Many, many thanks indeed.- Hide quoted text -


>>
>- Show quoted text -


>
>


Could it be that the problem is that the header template opens outside
the <tabletag and ends inside it? Could you move the opening table
tag below the header template?

On Mar 1, 11:07 am, "Aidy" <a...@dotnet.itags.org.noemail.xxxa.comwrote:

Quote:

Originally Posted by

I use the repeater;
>
<HeaderTemplate>
<table>
</HeaderTemplate>
>
<ItemTemplate>
<tr>
>
</tr>
</ItemTemplate>
>
<FooterTemplate>
</table>
</FooterTemplate>
>
<mj.redfox...@dotnet.itags.org.gmail.comwrote in message
>
news:1172764802.765456.68170@dotnet.itags.org.h3g2000cwc.googlegrou ps.com...
>
>
>

Quote:

Originally Posted by

Hi Aidy,


>

Quote:

Originally Posted by

Thanks for replying. Can I just ask which of the three techniques you
use...
1. <asp:table>
2. <table>
or
3. <table runat = "server">?


>

Quote:

Originally Posted by

On 1 Mar, 15:54, "Aidy" <a...@dotnet.itags.org.noemail.xxxa.comwrote:

Quote:

Originally Posted by

Are you sure it's an error? I use this technique all the time, it does
flag
up as a *warning*, but just ignore it.


>

Quote:

Originally Posted by

Quote:

Originally Posted by

<mj.redfox...@dotnet.itags.org.gmail.comwrote in message


>

Quote:

Originally Posted by

Quote:

Originally Posted by

>news:1172763165.984403.148440@dotnet.itags.org.z35g2000cwz.googlegr oups.com...


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Hello, I'm hoping someone can help me out with a very basic problem
that's got me tearing my hair out! I'm wanting to have a repeater that
adds some rows to a table as below:


>

Quote:

Originally Posted by

Quote:

Originally Posted by

<asp:Repeater ID="repeater1" runat="server">


>

Quote:

Originally Posted by

Quote:

Originally Posted by

<HeaderTemplate>
<table id="table1" runat="server">
<tr>{header code goes here}</tr>
</HeaderTemplate>


>

Quote:

Originally Posted by

Quote:

Originally Posted by

<ItemTemplate>
<tr><td>
<asp:DropDownList ID="ddl1" runat="server">{drop-down list code goes
here}</asp:DropDownList>
</td></tr>
</ItemTemplate>


>

Quote:

Originally Posted by

Quote:

Originally Posted by

<FooterTemplate>
</table>
</FooterTemplate>


>

Quote:

Originally Posted by

Quote:

Originally Posted by

1. However, because of the 'runat="server"' in the table tag, this
throws an 'Unexpected end of file looking for </HeaderTemplatetag'
error.


>

Quote:

Originally Posted by

Quote:

Originally Posted by

2. Removing the 'runat="server"' means that the code DOES compile -
however it seems to have the effect that whenever I try to do anything
with my drop-down list in the page-behind vb gives me a 'Object
reference not set to an instance of an object' error (not a problem
with the way I'm coding because the same line works fine in the vb if
the drop-down list is placed OUTSIDE of the table).


>

Quote:

Originally Posted by

Quote:

Originally Posted by

3. Also, the only other way I can think of to do this, to use an
<asp:tableinstead (which was actually my preferred choice if I could
have got it working) gives a 'Server elements cannot span templates'
error.


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Aaargghhh! There MUST be some way of having a repeater in a table as
above, AND allow server controls (that are actually useable) within
it. Can anyone help, as my head is sore from banging it against the
wall so much!


>

Quote:

Originally Posted by

Quote:

Originally Posted by

Many, many thanks indeed.- Hide quoted text -


>

Quote:

Originally Posted by

Quote:

Originally Posted by

- Show quoted text -- Hide quoted text -


>
- Show quoted text -

Newbie needing help with a simple ASP.NET <table> problem...!

Hello, I'm hoping someone can help me out with a very basic problem
that's got me tearing my hair out! I'm wanting to have a repeater that
adds some rows to a table as below:
<asp:Repeater ID="repeater1" runat="server">
<HeaderTemplate>
<table id="table1" runat="server">
<tr>{header code goes here}</tr>
</HeaderTemplate>
<ItemTemplate>
<tr><td>
<asp:DropDownList ID="ddl1" runat="server">{drop-down list code goes
here}</asp:DropDownList>
</td></tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
1. However, because of the 'runat="server"' in the table tag, this
throws an 'Unexpected end of file looking for </HeaderTemplate> tag'
error.
2. Removing the 'runat="server"' means that the code DOES compile -
however it seems to have the effect that whenever I try to do anything
with my drop-down list in the page-behind vb gives me a 'Object
reference not set to an instance of an object' error (not a problem
with the way I'm coding because the same line works fine in the vb if
the drop-down list is placed OUTSIDE of the table).
3. Also, the only other way I can think of to do this, to use an
<asp:table> instead (which was actually my preferred choice if I could
have got it working) gives a 'Server elements cannot span templates'
error.
Aaargghhh! There MUST be some way of having a repeater in a table as
above, AND allow server controls (that are actually useable) within
it. Can anyone help, as my head is sore from banging it against the
wall so much!
Many, many thanks indeed.Are you sure it's an error? I use this technique all the time, it does flag
up as a *warning*, but just ignore it.
<mj.redfox.mj@.gmail.com> wrote in message
news:1172763165.984403.148440@.z35g2000cwz.googlegroups.com...
> Hello, I'm hoping someone can help me out with a very basic problem
> that's got me tearing my hair out! I'm wanting to have a repeater that
> adds some rows to a table as below:
>
> <asp:Repeater ID="repeater1" runat="server">
> <HeaderTemplate>
> <table id="table1" runat="server">
> <tr>{header code goes here}</tr>
> </HeaderTemplate>
> <ItemTemplate>
> <tr><td>
> <asp:DropDownList ID="ddl1" runat="server">{drop-down list code goes
> here}</asp:DropDownList>
> </td></tr>
> </ItemTemplate>
> <FooterTemplate>
> </table>
> </FooterTemplate>
>
> 1. However, because of the 'runat="server"' in the table tag, this
> throws an 'Unexpected end of file looking for </HeaderTemplate> tag'
> error.
> 2. Removing the 'runat="server"' means that the code DOES compile -
> however it seems to have the effect that whenever I try to do anything
> with my drop-down list in the page-behind vb gives me a 'Object
> reference not set to an instance of an object' error (not a problem
> with the way I'm coding because the same line works fine in the vb if
> the drop-down list is placed OUTSIDE of the table).
> 3. Also, the only other way I can think of to do this, to use an
> <asp:table> instead (which was actually my preferred choice if I could
> have got it working) gives a 'Server elements cannot span templates'
> error.
>
> Aaargghhh! There MUST be some way of having a repeater in a table as
> above, AND allow server controls (that are actually useable) within
> it. Can anyone help, as my head is sore from banging it against the
> wall so much!
> Many, many thanks indeed.
>
Hi Aidy,
Thanks for replying. Can I just ask which of the three techniques you
use...
1. <asp:table>
2. <table>
or
3. <table runat = "server">?
On 1 Mar, 15:54, "Aidy" <a...@.noemail.xxxa.com> wrote:
> Are you sure it's an error? I use this technique all the time, it does fl
ag
> up as a *warning*, but just ignore it.
> <mj.redfox...@.gmail.com> wrote in message
> news:1172763165.984403.148440@.z35g2000cwz.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
> - Show quoted text -
I use the repeater;
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
<mj.redfox.mj@.gmail.com> wrote in message
news:1172764802.765456.68170@.h3g2000cwc.googlegroups.com...
> Hi Aidy,
> Thanks for replying. Can I just ask which of the three techniques you
> use...
> 1. <asp:table>
> 2. <table>
> or
> 3. <table runat = "server">?
> On 1 Mar, 15:54, "Aidy" <a...@.noemail.xxxa.com> wrote:
>
Could it be that the problem is that the header template opens outside
the <table> tag and ends inside it? Could you move the opening table
tag below the header template?
On Mar 1, 11:07 am, "Aidy" <a...@.noemail.xxxa.com> wrote:
> I use the repeater;
> <HeaderTemplate>
> <table>
> </HeaderTemplate>
> <ItemTemplate>
> <tr>
> </tr>
> </ItemTemplate>
> <FooterTemplate>
> </table>
> </FooterTemplate>
> <mj.redfox...@.gmail.com> wrote in message
> news:1172764802.765456.68170@.h3g2000cwc.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> - Show quoted text -