当我按下[backspace]时,IVE出现错误(一如既往) [英] When i hit [backspace] ive got an error (as always)

查看:90
本文介绍了当我按下[backspace]时,IVE出现错误(一如既往)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,先生,首先让我说我是这种编程语言的新手.现在,先生,这是我的问题.香港专业教育学院连接到其中会话的页面.现在,当我在第二页上完成我的第一选择时,我将返回第一页[使用退格键],然后选择另一个.一切进展顺利,但是当我选择返回我的第一选择时,它停留在我的最后选择上.请帮助不知道问题出在哪里
我在第一页上的代码:

Hello sirs, first of all let me say that I am a newbie in this programming language. Now sirs here is my problem. ive connected to pages with session in it. Now when im on the second page and done with my first choice I''ll return to the first page [using backspace] and choose another one. All went well but when I choose to go back on my first choice it stuck up on my last choice. plss help dont know what the problem is
My code on first page:

Partial Class UpdateTP
    Inherits System.Web.UI.Page



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        End Sub
    Protected Sub a2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles a2.Click
        Session("CC15029") = a2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub b2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles b2.Click
        Session("CC12934") = b2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub c2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles c2.Click
        Session("CC12935") = c2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub d2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles d2.Click
        Session("CC12938") = d2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub y2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles y2.Click
        Session("CC12939") = y2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub f2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles f2.Click
        Session("CC12940") = f2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub g2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles g2.Click
        Session("CC12941") = g2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub h2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles h2.Click
        Session("CC12942") = h2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub i2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles i2.Click
        Session("CC12943") = i2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub j2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles j2.Click
        Session("CC12944") = j2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub k2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles k2.Click
        Session("CC12948") = k2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub l2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles l2.Click
        Session("CC12950") = l2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub m2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles m2.Click
        Session("CC12952") = m2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub n2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles n2.Click
        Session("CC13082") = n2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub o2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles o2.Click
        Session("CC13154") = o2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub p2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles p2.Click
        Session("CC13241") = p2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub q2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles q2.Click
        Session("CC13242") = q2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub r2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles r2.Click
        Session("CC13244") = r2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub s2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles s2.Click
        Session("CC13245") = s2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub t2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles t2.Click
        Session("CC14699") = t2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub u2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles u2.Click
        Session("CC16121") = u2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub v2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles v2.Click
        Session("CC16339") = v2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub w2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles w2.Click
        Session("CC16565") = w2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub

    Protected Sub x2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles x2.Click
        Session("CC16646") = x2.Text
        Response.Redirect("TrainingPlanM.aspx")
    End Sub
End Class



我的第二页代码:



My Code on Second Page:

Public Sub sesyon()
        Dim cc15029 As String = Session("cc15029")
        Dim cc12934 As String = Session("cc12934")
        Dim cc12935 As String = Session("cc12935")
        Dim cc12938 As String = Session("cc12938")
        Dim cc12939 As String = Session("cc12939")
        Dim cc12940 As String = Session("cc12940")
        Dim cc12941 As String = Session("cc12941")
        Dim cc12942 As String = Session("cc12942")
        Dim cc12943 As String = Session("cc12943")
        Dim cc12944 As String = Session("cc12944")
        Dim cc12948 As String = Session("cc12948")
        Dim cc12950 As String = Session("cc12950")
        Dim cc12952 As String = Session("cc12952")
        Dim cc13082 As String = Session("cc13082")
        Dim cc13154 As String = Session("cc13154")
        Dim cc13241 As String = Session("cc13241")
        Dim cc13242 As String = Session("cc13242")
        Dim cc13244 As String = Session("cc13244")
        Dim cc13245 As String = Session("cc13245")
        Dim cc14699 As String = Session("cc14699")
        Dim cc16121 As String = Session("cc16121")
        Dim cc16339 As String = Session("cc16339")
        Dim cc16565 As String = Session("cc16565")
        Dim cc16646 As String = Session("cc16646")

        If Not cc15029 = "" Then
            lblcc.Text = cc15029
        End If
        If Not cc12934 = "" Then
            lblcc.Text = cc12934
        End If
        If Not cc12935 = "" Then
            lblcc.Text = cc12935
        End If
        If Not cc12938 = "" Then
            lblcc.Text = cc12938
        End If
        If Not cc12939 = "" Then
            lblcc.Text = cc12939
        End If
        If Not cc12940 = "" Then
            lblcc.Text = cc12940
        End If
        If Not cc12941 = "" Then
            lblcc.Text = cc12941
        End If
        If Not cc12942 = "" Then
            lblcc.Text = cc12942
        End If
        If Not cc12943 = "" Then
            lblcc.Text = cc12943
        End If
        If Not cc12944 = "" Then
            lblcc.Text = cc12944
        End If
        If Not cc12948 = "" Then
            lblcc.Text = cc12948
        End If
        If Not cc12950 = "" Then
            lblcc.Text = cc12950
        End If
        If Not cc12952 = "" Then
            lblcc.Text = cc12952
        End If
        If Not cc13082 = "" Then
            lblcc.Text = cc13082
        End If
        If Not cc13154 = "" Then
            lblcc.Text = cc13154
        End If
        If Not cc13241 = "" Then
            lblcc.Text = cc13241
        End If
        If Not cc13242 = "" Then
            lblcc.Text = cc13242
        End If
        If Not cc13244 = "" Then
            lblcc.Text = cc13244
        End If
        If Not cc13245 = "" Then
            lblcc.Text = cc13245
        End If
        If Not cc14699 = "" Then
            lblcc.Text = cc14699
        End If
        If Not cc16121 = "" Then
            lblcc.Text = cc16121
        End If
        If Not cc16339 = "" Then
            lblcc.Text = cc16339
        End If
        If Not cc16565 = "" Then
            lblcc.Text = cc16565
        End If
        If Not cc16646 = "" Then
            lblcc.Text = cc16646
        End If
    End Sub

推荐答案

所有这些都是灾难性的.为什么不告诉我们您要在这里做什么,以便我们可以告诉您如何不做不好呢?您不应该依赖单击退格"键返回上一页.您可以对指向上一页的链接进行编码,但是它将重新加载该页面,并且没有担保人将按原样选择进行操作.最好传递一个URL,您可以使用该URL在查询字符串上放置一个值以进行浏览.或者,如果用户要进行很多切换,则将两个页面控件都放在一个页面上,以便可以使用viewstate来存储值.
All of this is disasterous. Why not tell us what you''re trying to do here, so we can tell you how to not do it badly ? You should not rely on hitting ''backspace'' to go back to the previous page. You can code a link to the previous page, but it will reload the page, and there is no guarentee it will do it with things selected as they were. It''s better to pass a URL you can use to put a value on the query string to browse to. Or, if users are going to toggle a lot, make both pages controls and put them on the one page so you can use viewstate to store values.


不,这不是程序的方式可以写任何形式.编程全部涉及抽象和DRY原理(请不要重复自己,请参见 http://en.wikipedia.org/wiki /Don%27t_repeat_yourself [ ^ ]).

片段中有许多非常相似的代码行,其重复次数几乎是英语字母表中字母的数量(我不知道,为什么不是所有字母).这些片段中的每一个都不应重复;它应该显示0次或仅显示1次.听说过方法的参数吗?循环?

请勿使用立即数,尤其是字符串类型的立即数,例如"a","b"…甚至"也应写为string.Empty.

方法应该真正简短,每个方法都应具有明确的语义名称,以表明其目的.应遵守命名约定.

这些是基本标准.在完成此操作之前,任何编程活动都毫无意义.最好不要写任何东西(这一次用来阅读语言和编程),然后再写这种方式.对异常的任何讨论也是没有意义的.

—SA
No, this is not how a program of any kind can be written. Programming is all about abstraction and DRY principle (Don''t Repeat Yourself, see http://en.wikipedia.org/wiki/Don%27t_repeat_yourself[^]).

There are many very similar code lines of fragments repeated almost as many times as the number of letters in English alphabet (I have not idea, why not all of the letters). Each of these fragments should not be repeated; it should be presented zero times or only one time. Ever heard of parameters of method? of loops?

No immediate constants should be used, especially of string type, such as "a", "b"… Even "" should be written as string.Empty.

Methods should really short, each having clear semantic name suggestive of its purpose; naming conventions should be observed.

Those are elementary criteria. Until this is done, any programming activity makes no sense at all. It''s much better not to write anything (use this time for reading on language and programming), then to write this way. Any discussion of exceptions makes no sense as well.

—SA


这篇关于当我按下[backspace]时,IVE出现错误(一如既往)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆