473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Datagrid ItemCommand Fall Through??

I am getting the following error on this statement (Control cannot fall
through from one case label to another). Anyone heard this before?

private void DataGrid1_ItemCommand(object
source,System.Web.UI.WebControls.DataGridCommandEv entArgs e)

{

switch(e.CommandName)

{

case "FindCUID":
string vdgCUID;

Fleet.LDAP.AuthenticationServices User = new
Fleet.LDAP.AuthenticationServices();

DataSet dsCUID = new DataSet();

dsCUID = User.getUserInfo((string)e.Item.Cells[5].Text);

Label1.Text = vdgCUID;

e.Item.Cells[8].Text = (string)dsCUID.Tables[0].Rows[0]["sn"];//matches
dataset fields with textbox.

e.Item.Cells[7].Text = (string)dsCUID.Tables[0].Rows[0]["givenname"];
case "More":
Session["xUnit"] = e.Item.Cells[1].Text;

Session["xrcCode"] = e.Item.Cells[2].Text;

Session["xLastOdo"] = e.Item.Cells[3].Text;

Session["xDriver"] = e.Item.Cells[5].Text;

Session["xFirstName"] = e.Item.Cells[6].Text;

Session["xLastName"] = e.Item.Cells[7].Text;

Session["xLocation"] = e.Item.Cells[8].Text;

Session["xHome"] = e.Item.Cells[9].Text;

Server.Transfer("ChangeForm.aspx", true);

string sUrl = "ChangeForm.aspx";

string sFeatures = "'height=600;width=400;left=100;top=50;'";

string sScript;

sScript = "<script language=javascript>" +

"window.open('" + sUrl + "',''," + sFeatures + ");"+

"</script>";

// Write it into the output stream for immediate execution

Response.Write(sScript);} }
Nov 16 '05 #1
4 4454
On 24 Jun 2004 15:54, "Brian Conway" wrote:
I am getting the following error on this statement (Control cannot fall
through from one case label to another). Anyone heard this before?


Yes. The switch statement in C# does not support fall-through[1] and enforces
that by making you put something which will force the flow of control out
of the switch at the end of one case and before the next:
switch (a) {
case 1:
a++;
break; // <== must have
case 2:
a--;
return; // <== OK too
case 3:
a = a + b; // oh oh!
case 4: // can fall through as 4 and 5 are the same case
case 5: // [1] above
a = a - b;
throw new Exception("Just to show you can"); // This'll be OK too
}

--
Simon Smith
simon dot s at ghytred dot com
http://www.ghytred.com/NewsLook - Usenet for Outlook
Nov 16 '05 #2
You can "sort of" simulate fallthrough using the goto command.

switch (x)
{
case 0: a = a+b;
goto case 1;
case 1: a = a*b;
break;
default:
break;
}

In this example, if x==0, then a would get increased by b, and then multiplied by b.

HTH
--
Adam Clauss
ca*****@tamu.edu
"Simon Smith" <gh*****@community.com> wrote in message news:e2******************************@ghytred.com. ..
On 24 Jun 2004 15:54, "Brian Conway" wrote:
I am getting the following error on this statement (Control cannot fall
through from one case label to another). Anyone heard this before?


Yes. The switch statement in C# does not support fall-through[1] and enforces
that by making you put something which will force the flow of control out
of the switch at the end of one case and before the next:
switch (a) {
case 1:
a++;
break; // <== must have
case 2:
a--;
return; // <== OK too
case 3:
a = a + b; // oh oh!
case 4: // can fall through as 4 and 5 are the same case
case 5: // [1] above
a = a - b;
throw new Exception("Just to show you can"); // This'll be OK too
}

--
Simon Smith
simon dot s at ghytred dot com
http://www.ghytred.com/NewsLook - Usenet for Outlook

Nov 16 '05 #3
On 24 Jun 2004 17:58, "Adam Clauss" wrote:
You can "sort of" simulate fallthrough using the goto command.

switch (x)
{
case 0: a = a+b;
goto case 1;
case 1: a = a*b;
break;
default:
break;
}

In this example, if x==0, then a would get increased by b, and then multiplied
by b.

HTH


Yep - but I never use it so I didn't mention it :)
--
Simon Smith
simon dot s at ghytred dot com
http://www.ghytred.com/NewsLook - Usenet for Outlook
Nov 16 '05 #4
Hehe... I think I've used it once - for serialization.

--
Adam Clauss
ca*****@tamu.edu
"Simon Smith" <gh*****@community.com> wrote in message news:71******************************@ghytred.com. ..
On 24 Jun 2004 17:58, "Adam Clauss" wrote:
You can "sort of" simulate fallthrough using the goto command.

switch (x)
{
case 0: a = a+b;
goto case 1;
case 1: a = a*b;
break;
default:
break;
}

In this example, if x==0, then a would get increased by b, and then multiplied
by b.

HTH


Yep - but I never use it so I didn't mention it :)
--
Simon Smith
simon dot s at ghytred dot com
http://www.ghytred.com/NewsLook - Usenet for Outlook

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
0
by: Brian Conway | last post by:
I am getting the following error on this statement (Control cannot fall through from one case label to another). Anyone heard this before? private void DataGrid1_ItemCommand(object...
0
by: Mark Kelly | last post by:
(originally posted on framework.aspnet.datagridcontrol) Hi, I don't seem to be able to get a imagebutton (within a template column) to fire an itemcommand event when clicked. Looking through this...
0
by: Colin Ramsay | last post by:
Hi all, I don't normally post swathes of code like this but I am truly banging my head off my desk here... I've dynamically created a datagrid within a usercontrol. There are two columns...
3
by: Andrea Williams | last post by:
I still consider myself to be a novice with ASP.NET, and going through the samples in my books is not helping me spot the problem. I very often find my answer after I've posted so maybe it will...
4
by: The Alchemist | last post by:
I am having a problem with a dynamically-generated Datagrid. It is important to point out that this problem does not exist with a design-time created Datagrid, but only with a dynamically generated...
2
by: Deepesh | last post by:
Good day, I have a specific case of the DataGrid in my solution which is causing the ItemCommand Event Not Firing. So I'm creating a "Skinnable" set of controls. I seperate the actual ASCX file...
3
by: danc | last post by:
I have a datagrid with a checkbox and dropdown list in each row. Both set AutoPostBack to true and ItemCommand and OnSelectedIndexChanged events for these controls works fine when DataGrid is not...
0
by: jigsawcube1 | last post by:
I am trying to accept two input strings and concatinate and display the result in a datagrid. Following is the HTML and code. ItemCommand does not get fired what is that I am missing? <body...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.