Showing posts with label switch. Show all posts
Showing posts with label switch. Show all posts

Saturday, March 24, 2012

Suggestions visual studio - switch between design and html takes from 15 to 20 seconds - h

I am having this issue when i try to switch between the design view and source view ( the raw html view) or viceverse is taking from 15 to 20 seconds for the switch to happen.

if I take out all the html out of the page it switches back and forth right away. I have about 200 lines of html code

Is is always or just for one application. Did u try to restart your visual studio or kill the worker process or even restart your comp.

Suggestions: Filling calendar with db events

I have a bunch of events and appointments in a sql server db. What is the
best way to fill a calendar with this data? As I switch months I want it to
repopulate with the "current" months data.
I'd like it to kind of work like a basic Outlook calendar.
Thanks!1. Create a calendar interface in ASP.Net/HTML.
2. Populate it with data.
3. What exactly do you need help with?
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
>
I have a calendar on the aspx page. How can I bind it to data that comes
from a sql server db?
Ex:
Event 1 - 12/1/2004
Event 2 - 12/3/2004
Event 3 - 12/5/2004
So, if you were to go on the calendar to Dec 2004 Event 1 would show up in
the 12/1 box, Event 2 in the 12/3 box, etc... If I switched the calendar to
January it would populate the calendar with January events.
Thanks Kevin.
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:ukQqNsT3EHA.2624@.TK2MSFTNGP11.phx.gbl...
> 1. Create a calendar interface in ASP.Net/HTML.
> 2. Populate it with data.
> 3. What exactly do you need help with?
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
> "VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
> news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> to
>
check out these code samples:
http://aspnet101.com/aspnet101/aspn...?code=caltitles
http://aspnet101.com/aspnet101/aspn...spx?code=CalMdb
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
Coming Soon - Data Management Toolkit
Manage MSDE/SQL Server/MySQL/MS Access Databases from one location.
http://augustwind.com/augustwind/dmt.aspx
"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
>
(Sorry - the other link was supposed to be:
http://aspnet101.com/aspnet101/aspn...x?code=calendar)
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
Coming Soon - Data Management Toolkit
Manage MSDE/SQL Server/MySQL/MS Access Databases from one location.
http://augustwind.com/augustwind/dmt.aspx
"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
>

Suggestions: Filling calendar with db events

I have a bunch of events and appointments in a sql server db. What is the
best way to fill a calendar with this data? As I switch months I want it to
repopulate with the "current" months data.

I'd like it to kind of work like a basic Outlook calendar.

Thanks!1. Create a calendar interface in ASP.Net/HTML.
2. Populate it with data.
3. What exactly do you need help with?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
I have a calendar on the aspx page. How can I bind it to data that comes
from a sql server db?

Ex:
Event 1 - 12/1/2004
Event 2 - 12/3/2004
Event 3 - 12/5/2004

So, if you were to go on the calendar to Dec 2004 Event 1 would show up in
the 12/1 box, Event 2 in the 12/3 box, etc... If I switched the calendar to
January it would populate the calendar with January events.

Thanks Kevin.

"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:ukQqNsT3EHA.2624@.TK2MSFTNGP11.phx.gbl...
> 1. Create a calendar interface in ASP.Net/HTML.
> 2. Populate it with data.
> 3. What exactly do you need help with?
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
> "VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
> news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
>> I have a bunch of events and appointments in a sql server db. What is
>> the
>> best way to fill a calendar with this data? As I switch months I want it
> to
>> repopulate with the "current" months data.
>>
>> I'd like it to kind of work like a basic Outlook calendar.
>>
>> Thanks!
>>
>>
check out these code samples:
http://aspnet101.com/aspnet101/aspn...?code=caltitles
http://aspnet101.com/aspnet101/aspn...spx?code=CalMdb

David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
Coming Soon - Data Management Toolkit
Manage MSDE/SQL Server/MySQL/MS Access Databases from one location.
http://augustwind.com/augustwind/dmt.aspx

"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
(Sorry - the other link was supposed to be:
http://aspnet101.com/aspnet101/aspn...x?code=calendar)

David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
Coming Soon - Data Management Toolkit
Manage MSDE/SQL Server/MySQL/MS Access Databases from one location.
http://augustwind.com/augustwind/dmt.aspx

"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!

Tuesday, March 13, 2012

switch

Hi
Is it possible to replace this if statement by a switch?
private int doCalculation(int lhs, int rhs)
{
int result = 0;

if (addition.Checked)
result = addValues(lhs, rhs);
else if (subtraction.Checked)
result = subtractValues(lhs, rhs);
else if (multiplication.Checked)
result = multiplyValues(lhs, rhs);
else if (division.Checked)
result = divideValues(lhs, rhs);
else if (remainder.Checked)
result = remainderValues(lhs, rhs);

return result;
}

thanksI'm afraid not. You could use a ternary operator instead, but you're essentially doing the same thing as the if statements:

private int doCalculation(int lhs, int rhs)
{
return (addition.Checked) ? addValues(lhs, rhs) :
(subtraction.Checked) ? subtractValues(lhs, rhs) :
(multiplication.Checked) ? multiplyValues(lhs, rhs) :
(division.Checked) ? divideValues(lhs, rhs) :
(remainder.Checked) ? remainderValues(lhs, rhs) : 0;
}

i don't think so in C#

the shared thing in these Values is true Value
so, you will use it to compare it by all checked value for RadioButtons But C# Dont Agree but in case CONSTANT it agree for values only

But in VB.NET You Can Do That


Select Case True
Case addition.Checked

Case subtraction.Checked

Case multiplication.Checked

Case division.Checked

Case remainder.Checked

End Select


I can't either find out an answer because I think each if statement tests a different condition.

thanks for comments

Switch / case statements

Been a while since I did a switch statement, and that was in VB.
Error I'm getting is...
Control cannot fall through from one case label ('case 14:') to another
Well, not just case 14, but all of them.
Here's the sample...

publicbool checkMe(ArrayList myArray,int myInt){

switch (myInt) {

case 3 :

if(System.Convert.ToInt32( myArray[0] )== 0 &&

System.Convert.ToInt32( myArray[1]) == 1 )

{

myArray[1] = 0;

myArray[3] = 0;

myArray[0] = 1;

pNum = 3;

tempAL = myArray;

printArray(tempAL);

bSuccess =true;

break;

}

if( System.Convert.ToInt32( myArray[5] ) == 0 &&

System.Convert.ToInt32( myArray[4] ) == 1 )

{

myArray[4] = 0;

myArray[3] = 0;

myArray[5] = 1;

pNum = 3;

tempAL = myArray;

printArray(tempAL);

bSuccess =true;

break;

}

case 5 :

if( System.Convert.ToInt32( myArray[0] ) == 0 &&

System.Convert.ToInt32( myArray[2] ) == 1 )

{

myArray[2] = 0;

myArray[5] = 0;

myArray[0] = 1;

pNum = 5;

tempAL = myArray;

printArray(tempAL);

bSuccess =true;

break;

}

if( System.Convert.ToInt32( myArray[3] ) == 0 &&

System.Convert.ToInt32( myArray[4] ) == 1 )

{

myArray[4] = 0;

myArray[5] = 0;

myArray[3] = 1;

pNum = 5;

tempAL = myArray;

printArray(tempAL);

bSuccess =true;

break;

}

default :

{

bSuccess =false;

}


}

So, what's the deal?
Thanks,
Zath

That's because C# requires a break statement after every case statement (at least ones with code in them), and yours are within conditionals. Here's your code fixed up:
public bool checkMe(ArrayList myArray, int myInt)
{
switch ( myInt )
{
case 3:
if ( System.Convert.ToInt32(myArray[0]) == 0 &&
System.Convert.ToInt32(myArray[1]) == 1 )
{
myArray[1] = 0;
myArray[3] = 0;
myArray[0] = 1;

pNum = 3;
tempAL = myArray;
printArray(tempAL);

bSuccess = true;
break;
}

if ( System.Convert.ToInt32(myArray[5]) == 0 &&
System.Convert.ToInt32(myArray[4]) == 1 )
{
myArray[4] = 0;
myArray[3] = 0;
myArray[5] = 1;

pNum = 3;
tempAL = myArray;
printArray(tempAL);

bSuccess = true;

break;
}

break;
case 5:
if ( System.Convert.ToInt32(myArray[0]) == 0 &&
System.Convert.ToInt32(myArray[2]) == 1 )
{
myArray[2] = 0;
myArray[5] = 0;
myArray[0] = 1;

pNum = 5;
tempAL = myArray;
printArray(tempAL);

bSuccess = true;

break;
}


if ( System.Convert.ToInt32(myArray[3]) == 0 &&
System.Convert.ToInt32(myArray[4]) == 1 )

{
myArray[4] = 0;
myArray[5] = 0;
myArray[3] = 1;

pNum = 5;
tempAL = myArray;
printArray(tempAL);
bSuccess = true;

break;
}

break;
default :
bSuccess = false;

break;
} // end of switch statement
} // end of method


You could do something like this and it would work:
switch ( someValue )
{
case 0:
case 1:
// do something
break;
case 2:
// do something
break;
default:
break;
}
NC...


Thanks, that did the trick.
Just when you think you know all the syntaxBig Smile [:D]
Zath

Switch between TextBox and Label inside DataGrid

I have DataGrid with Label in one of its columns. Label should change into
TextBox, when user do some specific action. How can I acomplish this??

P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
because my OE news reader doesn't show all my posts.I'm trying this:

<asp:TemplateColumn HeaderText="Sum">
<ItemTemplate>
<asp:Label id="lblSum" runat="server" Text='<%#
Container.DataItem("Sum") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtSum" runat="server" Text='<%#
Container.DataItem("Sum") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn
but when I do this:

DataGrid1.EditItemIndex = index

all DataGrid fields in selected row becomes editable and I wan't only one
specific field to be editable (TextBox). What should I do? :(
You need to make an ItemTemplate including both the label and the textbox
and control their visibility depending
on user actions. For an experienced javascript programmer I would recommend
doing it on client side. Otherwise you can do it on server side, possibly
with AJAX or other similar technologies.

Eliyahu

"John Smith" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> I have DataGrid with Label in one of its columns. Label should change into
> TextBox, when user do some specific action. How can I acomplish this??
>
> P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
> because my OE news reader doesn't show all my posts.
Hi,

I think you want to edit values by switching between label and textbox. The
following link would be very helpful.

http://www.syncfusion.com/FAQ/aspnet/WEB_c4c.aspx#q391q

Thanks
Sharmila

"John Smith" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> I have DataGrid with Label in one of its columns. Label should change into
> TextBox, when user do some specific action. How can I acomplish this??
>
> P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
> because my OE news reader doesn't show all my posts.
Thanks.

Switch between TextBox and Label inside DataGrid

I have DataGrid with Label in one of its columns. Label should change into
TextBox, when user do some specific action. How can I acomplish this'
P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
because my OE news reader doesn't show all my posts.I'm trying this:
<asp:TemplateColumn HeaderText="Sum">
<ItemTemplate>
<asp:Label id="lblSum" runat="server" Text='<%#
Container.DataItem("Sum") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtSum" runat="server" Text='<%#
Container.DataItem("Sum") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
but when I do this:
DataGrid1.EditItemIndex = index
all DataGrid fields in selected row becomes editable and I wan't only one
specific field to be editable (TextBox). What should I do? :(
You need to make an ItemTemplate including both the label and the textbox
and control their visibility depending
on user actions. For an experienced javascript programmer I would recommend
doing it on client side. Otherwise you can do it on server side, possibly
with AJAX or other similar technologies.
Eliyahu
"John Smith" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> I have DataGrid with Label in one of its columns. Label should change into
> TextBox, when user do some specific action. How can I acomplish this'
>
> P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
> because my OE news reader doesn't show all my posts.
>
Hi,
I think you want to edit values by switching between label and textbox. The
following link would be very helpful.
http://www.syncfusion.com/FAQ/aspnet/WEB_c4c.aspx#q391q
Thanks
Sharmila
"John Smith" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> I have DataGrid with Label in one of its columns. Label should change into
> TextBox, when user do some specific action. How can I acomplish this'
>
> P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
> because my OE news reader doesn't show all my posts.
>
Thanks.

Switch case (C#)

How can a use a expression like (percent_ < 25) into the switch case?
It's returning me a error.

switch (percent_) {case(percent_ < 25): img.ImageUrl ="~/img/BarraHorizGreen.gif";break;case(percent_ > 40): img.ImageUrl ="~/img/BarraHorizRed.gif";break;default: img.ImageUrl ="~/img/BarraHorizYellow.gif"; }

Sorry, C# does not support fall-through cases, each case must be exact. ref:http://msdn2.microsoft.com/EN-US/library/aa664749(VS.71).aspx

Work around is easy, use if...else statement.


in VB it would be possible like..

Select Case XCase 126 to 500' any number between 126 and 500Case 5, 9, 125' 5 or 9 or 125Case is > 800' any number greater than 800Case Else'End Select
but i think it would nt be possible in C#.. you can use Else..IF  Ladder..
hope it helps./. 

switch case with enum

Hi

i am getting "a constant value is required" error when i use the enum value
in case statement/
Any ideas?

sample code:

myconfig.cs
----
public enum WebHostingTypes
{

[Description("BASIC")] Basic,

[Description("PLUS")] Plus,

[Description("PREM")] Premium

}

product.cs
------

switch(WebHostingType)

{

case objCommon.GetEnumValueDescription(myconfig.WebHost ingTypes.Basic):
break;

case ....

}

----------

Even if i tried using a something like

public enum Volume

{

Low,

Medium,

High

}

string myVolume = "Medium";

switch(myVolume)

{

case myconfig.Volume.Medium:
break;

case ....

}

- GaneEnumerated values are numbers. If you treat them as such you will have no
problems with them.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"gane kol" <ganekol@.softca.com> wrote in message
news:OY%23kHOlUFHA.1404@.TK2MSFTNGP09.phx.gbl...
> Hi
> i am getting "a constant value is required" error when i use the enum
> value
> in case statement/
> Any ideas?
> sample code:
> myconfig.cs
> ----
> public enum WebHostingTypes
> {
> [Description("BASIC")] Basic,
> [Description("PLUS")] Plus,
> [Description("PREM")] Premium
> }
> product.cs
> ------
> switch(WebHostingType)
> {
> case objCommon.GetEnumValueDescription(myconfig.WebHost ingTypes.Basic):
> break;
> case ....
> }
> ----------
> Even if i tried using a something like
> public enum Volume
> {
> Low,
> Medium,
> High
> }
> string myVolume = "Medium";
> switch(myVolume)
> {
> case myconfig.Volume.Medium:
> break;
> case ....
> }
> - Gane
well, ok. But i couldnt figure why the example below (2nd Example) is not
working for me, but worked for others (found in some tech articles).

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:eq2zl2lUFHA.3596@.TK2MSFTNGP14.phx.gbl...
> Enumerated values are numbers. If you treat them as such you will have no
> problems with them.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> What You Seek Is What You Get.
> "gane kol" <ganekol@.softca.com> wrote in message
> news:OY%23kHOlUFHA.1404@.TK2MSFTNGP09.phx.gbl...
> > Hi
> > i am getting "a constant value is required" error when i use the enum
> > value
> > in case statement/
> > Any ideas?
> > sample code:
> > myconfig.cs
> > ----
> > public enum WebHostingTypes
> > {
> > [Description("BASIC")] Basic,
> > [Description("PLUS")] Plus,
> > [Description("PREM")] Premium
> > }
> > product.cs
> > ------
> > switch(WebHostingType)
> > {
> > case objCommon.GetEnumValueDescription(myconfig.WebHost ingTypes.Basic):
> > break;
> > case ....
> > }
> > ----------

*********************** 2ND EXAMPLE

> > Even if i tried using a something like
> > public enum Volume
> > {
> > Low,
> > Medium,
> > High
> > }
> > string myVolume = "Medium";
> > switch(myVolume)
> > {
> > case myconfig.Volume.Medium:
> > break;
> > case ....
> > }
> > - Gane
> well, ok. But i couldnt figure why the example below (2nd Example) is not
> working for me, but worked for others (found in some tech articles).

I wouldn't know, as I haven't seen them. However, I can't see any good
reason for doing so. You have to be careful what tech articles you read, and
by whom they are written.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"gane kol" <ganekol@.softca.com> wrote in message
news:umQZaHmUFHA.3280@.TK2MSFTNGP10.phx.gbl...
> well, ok. But i couldnt figure why the example below (2nd Example) is not
> working for me, but worked for others (found in some tech articles).
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:eq2zl2lUFHA.3596@.TK2MSFTNGP14.phx.gbl...
>> Enumerated values are numbers. If you treat them as such you will have no
>> problems with them.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> What You Seek Is What You Get.
>>
>> "gane kol" <ganekol@.softca.com> wrote in message
>> news:OY%23kHOlUFHA.1404@.TK2MSFTNGP09.phx.gbl...
>> > Hi
>>> > i am getting "a constant value is required" error when i use the enum
>> > value
>> > in case statement/
>> > Any ideas?
>>> > sample code:
>>> > myconfig.cs
>> > ----
>> > public enum WebHostingTypes
>> > {
>>> > [Description("BASIC")] Basic,
>>> > [Description("PLUS")] Plus,
>>> > [Description("PREM")] Premium
>>> > }
>>> > product.cs
>> > ------
>>> > switch(WebHostingType)
>>> > {
>>> > case objCommon.GetEnumValueDescription(myconfig.WebHost ingTypes.Basic):
>> > break;
>>> > case ....
>>> > }
>>> > ----------
>>
>
> *********************** 2ND EXAMPLE
>> > Even if i tried using a something like
>>> > public enum Volume
>>> > {
>>> > Low,
>>> > Medium,
>>> > High
>>> > }
>>> > string myVolume = "Medium";
>>> > switch(myVolume)
>>> > {
>>> > case myconfig.Volume.Medium:
>> > break;
>>> > case ....
>>> > }
>>> > - Gane
>>>>
>>

switch connection string in xsd file

Hi,

I have 2 connectionstrings in the web.config file in my website. It has a xsd file of handling all the database calls etc.

I wonder how do I switch the connectionstring used in the xsd file in code-behind?

Basically, my web.config will have a setting indicates whether website is test mode or live mode in appSetting region:

<add key="mode" value="">

So:

<add key="mode" value="test"> <!--is testing mode-->

<add key="mode" value="live"> <!--is live mode-->

depend on this than the whole site is using the appropriate connection string, sample code:

public static string ConnectionString
{
get
{
if (IsTesting)
{
return ConfigurationManager.ConnectionStrings["Test"].ToString();
}
else
{
return ConfigurationManager.ConnectionStrings["Live"].ToString();
}
}
}

But how to you set the xsd file following this rule?

Thanks in advance.

Hi,

As far as I can see, we don't use .xsd file to switch this. From your code, I can see that your ConfigurationManager is reading from web.config for the targeted connectionstring directly. So the only thing we need to do is to set the IsTesting flag. I think you can add a new key in Web.Config to indicate if the testing mode is true or false.

switch case with enum

Hi
i am getting "a constant value is required" error when i use the enum value
in case statement/
Any ideas?
sample code:
myconfig.cs
--
public enum WebHostingTypes
{
[Description("BASIC")] Basic,
[Description("PLUS")] Plus,
[Description("PREM")] Premium
}
product.cs
--
switch(WebHostingType)
{
case objCommon.GetEnumValueDescription(myconfig.WebHostingTypes.Basic):
break;
case ....
}
Even if i tried using a something like
public enum Volume
{
Low,
Medium,
High
}
string myVolume = "Medium";
switch(myVolume)
{
case myconfig.Volume.Medium:
break;
case ....
}
- GaneEnumerated values are numbers. If you treat them as such you will have no
problems with them.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"gane kol" <ganekol@.softca.com> wrote in message
news:OY%23kHOlUFHA.1404@.TK2MSFTNGP09.phx.gbl...
> Hi
> i am getting "a constant value is required" error when i use the enum
> value
> in case statement/
> Any ideas?
> sample code:
> myconfig.cs
> --
> public enum WebHostingTypes
> {
> [Description("BASIC")] Basic,
> [Description("PLUS")] Plus,
> [Description("PREM")] Premium
> }
> product.cs
> --
> switch(WebHostingType)
> {
> case objCommon.GetEnumValueDescription(myconfig.WebHostingTypes.Basic):
> break;
> case ....
> }
> --
> Even if i tried using a something like
> public enum Volume
> {
> Low,
> Medium,
> High
> }
> string myVolume = "Medium";
> switch(myVolume)
> {
> case myconfig.Volume.Medium:
> break;
> case ....
> }
> - Gane
>
well, ok. But i couldnt figure why the example below (2nd Example) is not
working for me, but worked for others (found in some tech articles).
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:eq2zl2lUFHA.3596@.TK2MSFTNGP14.phx.gbl...
> Enumerated values are numbers. If you treat them as such you will have no
> problems with them.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> What You S Is What You Get.
> "gane kol" <ganekol@.softca.com> wrote in message
> news:OY%23kHOlUFHA.1404@.TK2MSFTNGP09.phx.gbl...
*********************** 2ND EXAMPLE
>
> well, ok. But i couldnt figure why the example below (2nd Example) is not
> working for me, but worked for others (found in some tech articles).
I wouldn't know, as I haven't seen them. However, I can't see any good
reason for doing so. You have to be careful what tech articles you read, and
by whom they are written.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
What You S Is What You Get.
"gane kol" <ganekol@.softca.com> wrote in message
news:umQZaHmUFHA.3280@.TK2MSFTNGP10.phx.gbl...
> well, ok. But i couldnt figure why the example below (2nd Example) is not
> working for me, but worked for others (found in some tech articles).
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:eq2zl2lUFHA.3596@.TK2MSFTNGP14.phx.gbl...
>
>
> *********************** 2ND EXAMPLE
>
>

Switch from Cassini to IIS on a project

I was dumb and created the project as FILE instead of HTTP. I have IIS installed and want to use it instead. How can I switch my project over, or do I have to recreate it and readd my items?

- Right click on the root node of the Solution Explorer

- Goto "Options"

- In the "Server" area, say "Use Custom Server" and set the "Base URL"

done


never mind... found it

START options... :}

Switch from ASPNET/NETWORK SERVICE Account

Hi,

I have a page which requests info from a number of machines and whenever I try to do this I get an 'access is denied' error message. How do I change the account that my page is using to one which actually has access to the machines.

Thanksthere is not really a straight-forward answer to this.

if all of these servers are on the same domain, then you will ba able to impersoninate a common user in the web.config ..

<identity impersonate="true" userName="domain_name\user" password="password"/
make sure this user has the appropiate permissions on all the folders your are trying to access.

by default, the ASP.NET Machine Account is used for all requests.

psi
thanks psi
see if the framework and/or the ASP.NET Machine Account is on all machines ... if it is, and all the servers are on the same domain, you should be able to set the service to network service ...

psi
Is there any other way I could do this? There is a single account on the domain that I can use but its password is changed frequently and it is a account which my boss would prefer not to have hard-coded into the web.config file.

Thanks again,
Tomas

Switch Image

How do i switch an image after a user select/browse another image. I'm able to save the image back in the server database. but is not able to switch to the selected image. Please help...Could you please give us more information on what you are trying to do, and perhaps some code?

Ok, a user in the system which profile has been stored in the database including the path of his photo is viewing his particular. ie: name, address, phone number, his picture, etc. This user wish to change his current photo posted before. Thus, a HTML FileField is provided for him to browse the image and save it into our server. What i want to do is, when a user click on the Update button. The older picture shown in the page will be replaced with his newly given picture. The path of the picture stored in server is successfully updated. And I set the code to retrieve this user's profile including his picture from the database again after the Update button is clicked. I've tested the code by Updating picture and certain information, i noticed that all information can be updated and replacing the old information on the screen except that the picture did not change to the newly added picture in the database. Any idea...?
Try to add this to your page:
<meta http-equiv="Expires" content="0" />

Thanks PaaB. But it's not working. Where do i put that line anyway. I put it in between <HEAD> and </HEAD>. Am i right?

Yes it is the right place.
Can you show the source code.
When user chnege the image, is then changed path and name of the picture? I think about that when would be changed only path and not name of the picture then IE possibly use picture saved on client computer?


As i mentioned earlier. I have a HTML FileField where user can browse image and update it. the system will then saved the image into the server and update the directory stored in database. Finally, the system should display the latest image newly added by this user, but it is not. The path and directory of new image is updated in the database. same goes to the image saved in the server. I don't know if i'm right. if wrong, please correct me. i think that the system take the same image downloaded previously in temp folder. and if i'm right, is there any method that i can call client computer to download the image again? Please advise...Thank u


What object do you use for display picture - Image Web Control or Image Html Element? Do you update the ImageUrl/src parameter on the "uploading" postback?


I'm using Html element. After the new image has been saved on the server and its directory in the database. User can choose to view the same info again by a single click. Thus, i recall the sub that display the information once again. the code for image is like this.

myCommand =New SqlCommand("SELECT * FROM User_Profile WHERE ([User_ID] = '" & userid & "' AND [Company_ID] = '" & compid & "')", myConnection)

myReader = myCommand.ExecuteReader

myReader.Read()

imgUser.Src = myReader.Item("Photo")

thats it.. any mistake on this one?


This isn't related to your image issue, but you should be using Parameters with your SQL statement:

myCommand =NewSqlCommand("SELECT * FROM User_Profile WHERE ([User_ID] = @.user_id AND [Company_ID] = @.company_id ')",myConnection)
myCommand.Parameters.Add(New SqlParameter("@.user_id",SqlDbType.Integer)).Value = userid
myCommand.Parameters.Add(New SqlParameter("@.company_id",SqlDbType.Integer)).Value = compid




tried your suggestion, but it's not working. And even other information also is not displaying. i know the usage of parameters, usually i used it with stored procedure. there's nothing wrong with plain sql command compare with 1 that using parameter right?

nickless1 wrote:


imgUser.Src = myReader.Item("Photo")


You might try this to see if it makes a difference:
imgUser.Src = myReader.Item("Photo") & "?" & System.DateTime.Now().ToString()
Also, see this KB article:IIS: How to Disable Caching of Specific MIME Types

nickless1 wrote:


tried your suggestion, but it's not working. And even other informationalso is not displaying. i know the usage of parameters, usually i usedit with stored procedure. there's nothing wrong with plain sql commandcompare with 1 that using parameter right?


Sorry, I shouldn't have confused the issue. To protect yourself fromSQL injectionyou should always use parameters in SQL statements; you should neverconcatenate user-supplied data to a string to be executed. Ididn't meant to introduce another problem, however. Once you havesolved your image caching problem you can post another question aboutthe parameter problem.

Yes...It works. Thanks a lot. I couldn't open the page u gave. Would u mind to explain how it works? Thanks again...
I'm glad that approach worked for you. (And I've now corrected the link that I posted.)

Hi,
Im having kind of the same problem you have. Could you explain how you managed to solve it? as you might now, this issue is a brainbuster! :S

Switch Off IE (Internet Explorer) Toolbars?

Hi All,

Can anoyone tell me how to:

Switch Off IE (Internet Explorer) Toolbars when my browser windo opens in my application.

crte a button that will close my page

cheers

any help most appreciated

rgs

TonyHi Tony,
You can not do it in current window. You can instead open new window without toolbars and close current. Seethis.
Hi

Thanks for that, just one question...where do I insert in in the asp.net page as I already have script tags with asp.net in them!!!

many thanks

Tony
Hi,

I have use default.aspx that redirects to app mainpage:

private void Page_Load(object sender, System.EventArgs e)
{
string apu = "/Application/AppMainPage.aspx";

string Script = "";

Script += "\n<script language=JavaScript id='StartMainWindow'>\n";
Script += "poppedwin = window.open('"+apu+"','Appmain','resizable=yes, width=1024,height=768,statusbar=no'); \n";
Script += "mainwindow = window.self; \n";
Script += "mainwindow.opener = window.self; \n";
Script += "mainwindow.close(); \n";
Script += "poppedwin.focus(); \n";
Script += "</script>";

Response.Write(Script);
Response.End();
}

I hope this helps.

- Antti -
Hi Tony,
You can insert client script tag anywhere you want (and more then one). Client script tags have no runat="server" attributes and processed differently from server side asp.net script tag.

switch project from "file" to "web"?

I've taken over a project from another for a webservice. He originally set it up as "file" based, so it's showing up as "c:\path\to\site" in the solution manager. This is causing issues and it should be setup as a website withhttp://virtual/to/site.

Is there a way to switch a file based one to a web based one and have it use IIS ?

Nevermind... just readded it manually to the solution, seemed to work

Hi:

I think you are talking about an ASP.NET 2.0 application?

You can simply make a File System application work smoothly with IIS, by creating a new website poiting to the folder of that application, and open a web path in VS 2005 instead of the File System

Am I getting you correct?

Regards


yes, the issue was that it was under source control...

It's all good now though, thank you.


Hi Curt, I am glad it worked fine now.

Take care my friend,

Regards

Switch page to SSL Programatically?

Howdy,
I'm trying to have select pages always be secure and others I don't care.
I'm using
If Request.ServerVariables("SERVER_PORT") = 80 Then
Dim strSecureURL
strSecureURL = "https://"
strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
strSecureURL = strSecureURL & Request.ServerVariables("URL")
Response.Redirect(strSecureURL)
End If
This works, but is there a better way for .net 2.0?
Thanks,
Merry Christmas
David LozziInstead of testing for the server port variable, test for the HTTPS
variable. It will return ON if it's a secure connection or OFF it is isn't.
This would avoid any issues where the server or ssl certificate is running
on a port other than 80.
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"David Lozzi" <dlozzi@.nospam.nospam> wrote in message
news:%23VNNyktGHHA.4112@.TK2MSFTNGP04.phx.gbl...
> Howdy,
> I'm trying to have select pages always be secure and others I don't care.
> I'm using
> If Request.ServerVariables("SERVER_PORT") = 80 Then
> Dim strSecureURL
> strSecureURL = "https://"
> strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
> strSecureURL = strSecureURL & Request.ServerVariables("URL")
> Response.Redirect(strSecureURL)
> End If
>
> This works, but is there a better way for .net 2.0?
>
> Thanks,
> Merry Christmas
> David Lozzi
>
"David Lozzi" <dlozzi@.nospam.nospam> wrote in message
news:%23VNNyktGHHA.4112@.TK2MSFTNGP04.phx.gbl...

> This works, but is there a better way for .net 2.0?
http://www.codeproject.com/aspnet/W...&select=1697847

Switch page to SSL Programatically?

Howdy,

I'm trying to have select pages always be secure and others I don't care.
I'm using

If Request.ServerVariables("SERVER_PORT") = 80 Then

Dim strSecureURL

strSecureURL = "https://"

strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")

strSecureURL = strSecureURL & Request.ServerVariables("URL")

Response.Redirect(strSecureURL)

End If

This works, but is there a better way for .net 2.0?

Thanks,

Merry Christmas

David LozziInstead of testing for the server port variable, test for the HTTPS
variable. It will return ON if it's a secure connection or OFF it is isn't.
This would avoid any issues where the server or ssl certificate is running
on a port other than 80.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"David Lozzi" <dlozzi@.nospam.nospamwrote in message
news:%23VNNyktGHHA.4112@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

Howdy,
>
I'm trying to have select pages always be secure and others I don't care.
I'm using
>
If Request.ServerVariables("SERVER_PORT") = 80 Then
>
Dim strSecureURL
>
strSecureURL = "https://"
>
strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
>
strSecureURL = strSecureURL & Request.ServerVariables("URL")
>
Response.Redirect(strSecureURL)
>
End If
>
>
>
This works, but is there a better way for .net 2.0?
>
>
>
Thanks,
>
Merry Christmas
>
David Lozzi
>
>


"David Lozzi" <dlozzi@.nospam.nospamwrote in message
news:%23VNNyktGHHA.4112@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

This works, but is there a better way for .net 2.0?


http://www.codeproject.com/aspnet/W...&select=1697847

switch statement

I have the following switch statement and am getting the error:
not all code paths return a value
I am not seeing why.

publicbool checkNewMove(ArrayList myArray,int myInt)

{

switch (myInt)

{

case 4 :

if( System.Convert.ToInt32( myArray[13] ) == 0 &&

System.Convert.ToInt32( myArrayMusic [8] ) == 1 )

{

myArrayMusic [8] = 0;

myArray[4] = 0;

myArray[13] = 1;

pNum = 4;

tempAL = myArray;

printArray(tempAL);

bSuccess =true;

break;

}

break;

default :

{

bSuccess =false;

//return bSuccess;

break;

}

//break;

}// end switch


}
Suggestions?
Thanks,
ZathI have added the line you are missing in red

publicbool checkNewMove(ArrayList myArray,int myInt)
{
switch (myInt)
{
case 4 :
if( System.Convert.ToInt32( myArray[13] ) == 0 &&
System.Convert.ToInt32( myArray[WhateverNumberThisIsSupposedToBe] ) == 1 )
{
myArray[WhateverNumberThisIsSupposedToBe] = 0;
myArray[4] = 0;
myArray[13] = 1;
pNum = 4;
tempAL = myArray;
printArray(tempAL);
bSuccess =true;
break;
}
break;
default :
{
bSuccess =false;
//return bSuccess;
break;
}
}// end switch
return bSuccess; [EDIT]
}


Thanks. don't know why I didn't see that. I have written many functions that need a return.
Must have been I was looking too hard at the switch.
Zath

switch statement error?

This is my first application so be gentle. :) I'm using WebMatrix.
I have the following code in index.aspx

<script runat="server">
switch(Request.QueryString["page"]) {
case "products":
masterForm.Controls.Add(LoadControl("products.ascx"));
break;
}
</script
masterForm is the id of the form tag in index.aspx

I am basically trying to dynamically include each section and use index.aspx as the master template file.

Here's the error:
Compiler Error Message: CS1519: Invalid token 'switch' in class, struct, or interface member declaration

It's stopping on the line with the switch statement.

What am I doing wrong?what is "page" in the following code

switch(Request.QueryString["page"])


page is supposed to be coming from:

index.aspx?page=products
ok I think the problem is that you are declaring switch in the HTML View. You need to run this code in the code behind file where all the Page_Load and Page_Init methods are. I hope you understand what I am trying to say.
Thanks, that did it!


<script runat="server">
void Page_Load() {
switch(Request.QueryString["page"]) {
case "products":
masterForm.Controls.Add(LoadControl("products.ascx"));
break;
}
}
</script>

Mohammed, WebMatrix doesn't permit the use of CodeBehind.

grizjr, you need to place the switch in the Page_Load method. For example:

 void Page_Load(Object Sender, EventArgs E) {

switch (...) {
...
}
}

Obviously you've decided against my suggestion of simplifying your code.
The code is not working properly.
<script runat="server">

void Page_Load() {

switch(Request.QueryString["page"]) {

case "products":

masterForm.Controls.Add(LoadControl("products.ascx"));

break;

}

}

</script>
When I try and run it: I get this message:

Active Server Pages-Error 'ASP 0124'

Missing Language attribute

/nbhs/control-panel/switch.asp, line 2

The required Language attribute of the script tag is missing.

Active Server Pages-Error 'ASP 0124'


What tag is it missing?Tongue Tied [:S]


Now that problem is fixed with this line of code:
<script language="vbscript" runat="server">
I just needed to add language="vbscript"
now I get another problem
This is the code that I have:
<script language="vbscript" runat="server">

void Page_Load(Object Sender, EventArgs E) {
switch(Request.QueryString["page"]) {

case "products":

masterForm.Controls.Add(LoadControl("products.ascx"));

break;

}

}

</script>

The error that I get is this:


Microsoft VBScript compilation error-Error '800a03ee'

Expected ')'

/nbhs/control-panel/switch.asp, line 5

void Page_Load(Object Sender, EventArgs E) {
--------^

How can I fix this?