Showing posts with label load. Show all posts
Showing posts with label load. Show all posts

Saturday, March 31, 2012

The best place

Hi,

where is the best place for setting components on load but only if
this is not a postback?

protected void Page_Load(object sender, EventArgs e) {
if(!Page.IsPostBack) {
//here?
}
}

Regards,
Etam.On May 27, 8:42 pm, etam <odwrot...@dotnet.itags.org.gmail.comwrote:

Quote:

Originally Posted by

Hi,
>
where is the best place for setting components on load but only if
this is not a postback?
>
protected void Page_Load(object sender, EventArgs e) {
if(!Page.IsPostBack) {
//here?
}
}
>
Regards,
Etam.


yup :-)
That's not a terrible place, although the Page_Init event might be better
depending on exactly what it is you're trying to do.

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"etam" <odwrotnie@dotnet.itags.org.gmail.comwrote in message
news:1180291329.036276.205340@dotnet.itags.org.m36g2000hse.googlegr oups.com...

Quote:

Originally Posted by

Hi,
>
where is the best place for setting components on load but only if
this is not a postback?
>
protected void Page_Load(object sender, EventArgs e) {
if(!Page.IsPostBack) {
//here?
}
}
>
Regards,
Etam.
>

The best place

Hi,
where is the best place for setting components on load but only if
this is not a postback?
protected void Page_Load(object sender, EventArgs e) {
if(!Page.IsPostBack) {
//here?
}
}
Regards,
Etam.On May 27, 8:42 pm, etam <odwrot...@dotnet.itags.org.gmail.com> wrote:
> Hi,
> where is the best place for setting components on load but only if
> this is not a postback?
> protected void Page_Load(object sender, EventArgs e) {
> if(!Page.IsPostBack) {
> //here?
> }
> }
> Regards,
> Etam.
yup :-)
That's not a terrible place, although the Page_Init event might be better
depending on exactly what it is you're trying to do.
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"etam" <odwrotnie@dotnet.itags.org.gmail.com> wrote in message
news:1180291329.036276.205340@dotnet.itags.org.m36g2000hse.googlegroups.com...
> Hi,
> where is the best place for setting components on load but only if
> this is not a postback?
> protected void Page_Load(object sender, EventArgs e) {
> if(!Page.IsPostBack) {
> //here?
> }
> }
> Regards,
> Etam.
>

Monday, March 26, 2012

The ConnectionString property has not been initialized

Hi all,

I have developed a web page using asp.net. When testing ( debugging ) it from the VS 2005 it works properly.

In the load of the page I created a SqlConnection and specified the ConnectionString

The problem is when calling the page from a Fox Pro 9.0 application I get this message:

The ConnectionString property has not been initialized.

It seems that when calling the page from Fox Pro the ConnectionString is written incorrectly in the load method of the page

So does anyone have any suggestion?

Regards

Could you please specify the connection string over here. Also make sure that you have used new keyword while defining the connection string

Regards,

Suhas


Hi,

There is a article onconnection string here.

Saturday, March 24, 2012

The directive Page is unknown

I am learning ASP.NET
I downloaded source code fromwww.planet-source-code.com
but when I tried to load Default.aspx got this error:

The directive 'Page' is unknown

Here is the first line form my Default.aspx:

<%@dotnet.itags.org. Page language="c#" AutoEventWireup="false" CodeFile="Default.aspx.cs" Inherits="_Default" CodeBehind="Default.aspx.cs" %>

What's wrong with "Page" ?

what did you "load" it into ? the syntax looks right

Thursday, March 22, 2012

The first application gives server load error

I'm new to asp.net. Started following a book, I created a FirstApplication and when i try to run it on the browser it gives me the server parse error 'firstapplication.global file not loaded'. Error line 1.
I have not changed anything except for adding a header in the global.aspx file in between the form tags. also the application did'nt create the .vsdisco file. Heard vs2003 does'nt create one. Does it have to do anything with it. Help please!!!!!!!!!!!a header in global.aspx ?
global.aspx to my knowledge isnt used for anything other than writing
applicaiton onstart... on end... session on start and on end etc...
you just write methods for each in global file.
remove the header (cause i dont know y you are adding that header)
open the code file... gloabal.aspx.cs or vb

save the project... build it... and run it...

HTH

HD

"BSL" <anonymous@.discussions.microsoft.com> wrote in message
news:C4D05D3F-F9B6-44F2-B649-A78B81844844@.microsoft.com...
> I'm new to asp.net. Started following a book, I created a FirstApplication
and when i try to run it on the browser it gives me the server parse error
'firstapplication.global file not loaded'. Error line 1.
> I have not changed anything except for adding a header in the global.aspx
file in between the form tags. also the application did'nt create the
..vsdisco file. Heard vs2003 does'nt create one. Does it have to do anything
with it. Help please!!!!!!!!!!!

The first intem in a DropDownList is vanishing!

The first intem in a DropDownList is vanishing!

My code to load a DropDownList is shown below. Yet when I load the
page after a postback there is no zeroth item present.

lstManager.Items.Clear();

lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
lstManager.DataValueField = "ManagerID";
lstManager.DataTextField = "Name";
lstManager.DataBind();

lstManager.Items.Insert(0, new ListItem("none", "0"));

There's nothing special about the control definition:

<asp:DropDownList ID="lstManager" runat="server" Height="20px"
Width="250px" />

What's going on here?

This was the old code I replaced. Why does the old code (below) work
and why is my new code (above) broke?

lstManager.Items.Clear();

ListItem li = new ListItem("none","0");
lstManager.Items.Add(li);

foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
{
ListItem liManager = new ListItem((string)drManager["Name"],
((int)drManager["ManagerID"]).ToString());
lstManager.Items.Add(liManager);
}I had this one a while back; turns out I was using simple properties
on a Master Page that required a DataBind() call to bind them. When
it was called, it was also rebinding the content page, which loses the
manually added items.

I recall this issue also happened with an ASCX file on the page, or if
you call a generic DataBind() any time after the addition of
ListItems, etc.

Dunc
http://www.fluidfoundation.com
On 1 Jun, 15:24, mark4asp <mark4...@.gmail.comwrote:

Quote:

Originally Posted by

The first intem in a DropDownList is vanishing!
>
My code to load a DropDownList is shown below. Yet when I load the
page after a postback there is no zeroth item present.
>
lstManager.Items.Clear();
>
lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
lstManager.DataValueField = "ManagerID";
lstManager.DataTextField = "Name";
lstManager.DataBind();
>
lstManager.Items.Insert(0, new ListItem("none", "0"));
>
There's nothing special about the control definition:
>
<asp:DropDownList ID="lstManager" runat="server" Height="20px"
Width="250px" />
>
What's going on here?
>
This was the old code I replaced. Why does the old code (below) work
and why is my new code (above) broke?
>
lstManager.Items.Clear();
>
ListItem li = new ListItem("none","0");
lstManager.Items.Add(li);
>
foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
{
ListItem liManager = new ListItem((string)drManager["Name"],
((int)drManager["ManagerID"]).ToString());
lstManager.Items.Add(liManager);
}


On 1 Jun, 16:30, Dunc <duncan.we...@.gmail.comwrote:

Quote:

Originally Posted by

I had this one a while back; turns out I was using simple properties
on a Master Page that required a DataBind() call to bind them. When
it was called, it was also rebinding the content page, which loses the
manually added items.
>
I recall this issue also happened with an ASCX file on the page, or if
you call a generic DataBind() any time after the addition of
ListItems, etc.
>
Dunchttp://www.fluidfoundation.com
>
On 1 Jun, 15:24, mark4asp <mark4...@.gmail.comwrote:
>
>
>

Quote:

Originally Posted by

The first intem in a DropDownList is vanishing!


>

Quote:

Originally Posted by

My code to load a DropDownList is shown below. Yet when I load the
page after a postback there is no zeroth item present.


>

Quote:

Originally Posted by

lstManager.Items.Clear();


>

Quote:

Originally Posted by

lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
lstManager.DataValueField = "ManagerID";
lstManager.DataTextField = "Name";
lstManager.DataBind();


>

Quote:

Originally Posted by

lstManager.Items.Insert(0, new ListItem("none", "0"));


>

Quote:

Originally Posted by

There's nothing special about the control definition:


>

Quote:

Originally Posted by

<asp:DropDownList ID="lstManager" runat="server" Height="20px"
Width="250px" />


>

Quote:

Originally Posted by

What's going on here?


>

Quote:

Originally Posted by

This was the old code I replaced. Why does the old code (below) work
and why is my new code (above) broke?


>

Quote:

Originally Posted by

lstManager.Items.Clear();


>

Quote:

Originally Posted by

ListItem li = new ListItem("none","0");
lstManager.Items.Add(li);


>

Quote:

Originally Posted by

foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
{
ListItem liManager = new ListItem((string)drManager["Name"],
((int)drManager["ManagerID"]).ToString());
lstManager.Items.Add(liManager);
}- Hide quoted text -


>
- Show quoted text -


Thanks Dunc, for sharing that with me - that scenario you described
sounds very like mine.

The first intem in a DropDownList is vanishing!

The first intem in a DropDownList is vanishing!
My code to load a DropDownList is shown below. Yet when I load the
page after a postback there is no zeroth item present.
lstManager.Items.Clear();
lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
lstManager.DataValueField = "ManagerID";
lstManager.DataTextField = "Name";
lstManager.DataBind();
lstManager.Items.Insert(0, new ListItem("none", "0"));
There's nothing special about the control definition:
<asp:DropDownList ID="lstManager" runat="server" Height="20px"
Width="250px" />
What's going on here?
This was the old code I replaced. Why does the old code (below) work
and why is my new code (above) broke?
lstManager.Items.Clear();
ListItem li = new ListItem("none","0");
lstManager.Items.Add(li);
foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
{
ListItem liManager = new ListItem((string)drManager["Name"],
((int)drManager["ManagerID"]).ToString());
lstManager.Items.Add(liManager);
}I had this one a while back; turns out I was using simple properties
on a Master Page that required a DataBind() call to bind them. When
it was called, it was also rebinding the content page, which loses the
manually added items.
I recall this issue also happened with an ASCX file on the page, or if
you call a generic DataBind() any time after the addition of
ListItems, etc.
Dunc
http://www.fluidfoundation.com
On 1 Jun, 15:24, mark4asp <mark4...@.gmail.com> wrote:
> The first intem in a DropDownList is vanishing!
> My code to load a DropDownList is shown below. Yet when I load the
> page after a postback there is no zeroth item present.
> lstManager.Items.Clear();
> lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
> lstManager.DataValueField = "ManagerID";
> lstManager.DataTextField = "Name";
> lstManager.DataBind();
> lstManager.Items.Insert(0, new ListItem("none", "0"));
> There's nothing special about the control definition:
> <asp:DropDownList ID="lstManager" runat="server" Height="20px"
> Width="250px" />
> What's going on here?
> This was the old code I replaced. Why does the old code (below) work
> and why is my new code (above) broke?
> lstManager.Items.Clear();
> ListItem li = new ListItem("none","0");
> lstManager.Items.Add(li);
> foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
> {
> ListItem liManager = new ListItem((string)drManager["Name"],
> ((int)drManager["ManagerID"]).ToString());
> lstManager.Items.Add(liManager);
> }
On 1 Jun, 16:30, Dunc <duncan.we...@.gmail.com> wrote:
> I had this one a while back; turns out I was using simple properties
> on a Master Page that required a DataBind() call to bind them. When
> it was called, it was also rebinding the content page, which loses the
> manually added items.
> I recall this issue also happened with an ASCX file on the page, or if
> you call a generic DataBind() any time after the addition of
> ListItems, etc.
> Dunchttp://www.fluidfoundation.com
> On 1 Jun, 15:24, mark4asp <mark4...@.gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
> - Show quoted text -
Thanks Dunc, for sharing that with me - that scenario you described
sounds very like mine.

The fun never ends...

Hey all,
I've just installed Win2003 and having no end of trouble getting my
projects(created under win2K) to load. I'm having trouble getting my
project to load from my webserver. Whenever I load it, it makes a local
copy and I "Work offline". Not ALL my projects do this, just some. Where
do I configure that within the project so that I can work "online" from my
server? MANY thanks in advance!
wardeauxThanks anyways... as soon as I posted this message I found my answer...
figures... I'm developing this intense love-hate relationship with Win2K3...
wardeaux
"Wardeaux" <wardeaux@.bellsouth.net> wrote in message
news:OSIT9%23JLEHA.1032@.tk2msftngp13.phx.gbl...
> Hey all,
> I've just installed Win2003 and having no end of trouble getting my
> projects(created under win2K) to load. I'm having trouble getting my
> project to load from my webserver. Whenever I load it, it makes a local
> copy and I "Work offline". Not ALL my projects do this, just some. Where
> do I configure that within the project so that I can work "online" from my
> server? MANY thanks in advance!
> wardeaux

The fun never ends...

Hey all,
I've just installed Win2003 and having no end of trouble getting my
projects(created under win2K) to load. I'm having trouble getting my
project to load from my webserver. Whenever I load it, it makes a local
copy and I "Work offline". Not ALL my projects do this, just some. Where
do I configure that within the project so that I can work "online" from my
server? MANY thanks in advance!
wardeauxThanks anyways... as soon as I posted this message I found my answer...
figures... I'm developing this intense love-hate relationship with Win2K3...
wardeaux
"Wardeaux" <wardeaux@.bellsouth.net> wrote in message
news:OSIT9%23JLEHA.1032@.tk2msftngp13.phx.gbl...
> Hey all,
> I've just installed Win2003 and having no end of trouble getting my
> projects(created under win2K) to load. I'm having trouble getting my
> project to load from my webserver. Whenever I load it, it makes a local
> copy and I "Work offline". Not ALL my projects do this, just some. Where
> do I configure that within the project so that I can work "online" from my
> server? MANY thanks in advance!
> wardeaux
>