ASP.NET 变量问题

发布于 2024-07-15 20:12:19 字数 951 浏览 3 评论 0原文

我有一些写得很糟糕的 ASP.NET 代码,但无法正常工作(见图)。 我负责维护和修复此代码的错误,但我几乎无法理解它,

不幸的是我没有时间重写它。

如果有人可以提供帮助,那就太好了:(

代码):在这里给你(需要一些最小的混淆): http://mastergeektheater.com/issues.txt

它应该做什么: 从购物车应用程序接收订单,并根据所订购的所述对象的数量创建文本框表。 一旦整个事情被验证(submit_Click()),它就会显示一个带有进一步说明的 div 并将输入字段变灰,这样您仍然可以看到输入的内容,但不会再产生影响。 电子邮件将发送到每个输入的电子邮件地址。

它实际上做了什么: 接收订单并正确显示输入。 在提交时,所有“必填字段验证器都会触发 - 如果它们是有效的,那么比较验证器就会触发。在这里的某个地方,一切都变糟了。”

表中除第一个用户外的所有输入区域都会消失。 如果比较成功,则回发,并且第一个用户在那里(灰显),而其他用户则消失。 如果比较失败,则它不会成功回发,并保留在输入表单上,但除第一个用户之外的所有输入字段仍然消失

我知道这有点太具体了,无法成为确实是很好的堆栈溢出问题,但我试图将其分解为我认为错误的事情,并且我提出了其他更具体的问题来尝试修复它。 不幸的是,它没有奏效。 代码变得更好了,但整个事情仍然被破坏。 此时我已经绝望了。

如果有人能提供帮助,那将是一个巨大的救星。 预先感谢所有花一分钟时间浏览这个可怕的代码(和可怕的问题)的人......

I have some terribly written ASP.NET code that is just not working right (go figure).
I'm charged with maintaining and bug fixing this code, but I can barely make head or high water of it

Unfortunately I don't have the time to rewrite it.

If someone could help this would be great:

(the code): given to you here (some minimal obfuscation necessary):
http://mastergeektheater.com/issues.txt

What it's supposed to do:
Receives an order from a shopping cart application, and creates a table of textboxes based on the quantity of said object ordered.
Once the whole thing is validated (submit_Click()), then it reveals a div with further instructions and grays out the input fields so you can still see what was entered, but can't affect anymore. Emails are sent to each inputted email address.

What it actually does:
Receives the order, and correctly displays the inputs. On Submit, all of the "required field validators fire - if they are Vaild, then the comparison validators fire. SOMEWHERE AROUND HERE, it all goes south."

All of the input areas in the table except the first user disappear. if the comparisons success, then it postsback, and the first user is there (greyed out) and the other users are gone. if the comparisons fail, then it doesn't successfully postback, and stays on the input form, but all of the input fields except the first user still disappear

I know this is a little too specific to be a really well formed Stack Overflow question, but I've tried to break it down to things I think were wrong and I asked other questions that were more specific to try to fix it. Unfortunately, it hasn't worked. The code got better, but the whole thing is still broken. At this point I'm desperate.

If anyone could help, it would be a huge lifesaver. Thanks in advance for all of you who pour through this terrible code (and terrible question) for even a minute...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒浓于脸红 2024-07-22 20:12:19

我猜问题可能是由于这条线造成的。

<代码>
会话[“数量”] =(null != 请求[“数量1”]) ? 请求["数量1"].ToString() : "1";

表单上是否有名为 amount1 的字段(隐藏/输入)?
它是被传递给查询字符串还是作为表单项集合的一部分?

它将是 1(当表单回发给自身时)& 因此循环只会运行一次。

I guess the problem could be due to this line.


Session["quantity"] =(null != Request["quantity1"]) ? Request["quantity1"].ToString() : "1";

Do you have a field (hidden/input) named quantity1 on the form?
Is it being passed to querystring or as part of form item collection?

It will be 1 (when the form posts back to itself) & hence the loop will only run once.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文