EventValidation razzle dazzle

Ask a Question related to ASP Components, Design and Development.

  1. #1

    Default EventValidation razzle dazzle

    I've go a litle userwebcontrol that has i button. this button when clicked
    hides a label and shows a textbox in its place (code 1).

    Works fine until i put it into a datalist or similiar thing. As you culd
    expect, or may be you shouldn't, Asp shouts something about event validation.
    We all know what it is but the question is how should this object or/and this
    event be registred to work correctly.

    I know what to do when there is an extra position in combox or similary
    (---code-- Page.ClientScript.RegisterForEventValidation(
    this.UniqueID,
    "4"
    );
    ---/end code ---)
    but what with that event.

    I event tried code 2 in the control.
    What can i do?

    ---code 1
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
    <ContentTemplate>
    <asp:Literal ID="LiteralTresci" runat="server" Mode="PassThrough"
    EnableViewState="False"
    Text="[Lokalizowany
    Literal]"></asp:Literal><asp:ImageButton ID="EditButton"
    runat="server" SkinID="PrzyciskEdycji"
    OnClick="EditButton_Click" EnableViewState="false"
    Visible="False" CausesValidation="False" />
    <table runat="server" id="KontenerEdycji" visible="false"
    style="border-collapse: collapse;
    margin: 0; padding: 0; background-color: #ffff99; color: Black;
    font-size: 10px;">
    <tr>
    <td style="height: 26px">
    <asp:TextBox ID="EditTextBox" runat="server"
    EnableViewState="False"></asp:TextBox>
    <asp:LinkButton ID="AcceptBtn" runat="server"
    OnClick="AcceptBtn_Click" CausesValidation="False">Apply</asp:LinkButton>
    <asp:LinkButton ID="CancelBtn" runat="server"
    OnClick="CancelBtn_Click" CausesValidation="False">Cancel</asp:LinkButton>

    </td>
    </tr>
    </table>
    </ContentTemplate>
    </asp:UpdatePanel>
    ---/end code 1


    ---code 2

    void Register(Control ct)
    {
    foreach (Control c in ct.Controls)
    {

    this.Page.ClientScript.RegisterForEventValidation( c.UniqueID.ToString());
    Register(c);
    }


    }

    protected override void Render(HtmlTextWriter writer)
    {
    Register(this);
    base.Render(writer);
    }

    ---/end code 2
    Doker Guest

  2. Similar Questions and Discussions

    1. Dazzle 6-in-1 card reader for $9
      I've had this card reader for about a year now. It's worked well for me, ahthough I've only used one type of media (smartmedia). I paid a lot more...
  3. #2

    Default Re: EventValidation razzle dazzle

    post here for ASP.net help

    microsoft.public.dotnet.framework.aspnet










    "Doker" <Doker@discussions.microsoft.com> wrote in message news:72AC8CCF-16DC-4977-A2D7-EF83D5FBDF8B@microsoft.com...
    > I've go a litle userwebcontrol that has i button. this button when clicked
    > hides a label and shows a textbox in its place (code 1).
    >
    > Works fine until i put it into a datalist or similiar thing. As you culd
    > expect, or may be you shouldn't, Asp shouts something about event validation.
    > We all know what it is but the question is how should this object or/and this
    > event be registred to work correctly.
    >
    > I know what to do when there is an extra position in combox or similary
    > (---code-- Page.ClientScript.RegisterForEventValidation(
    > this.UniqueID,
    > "4"
    > );
    > ---/end code ---)
    > but what with that event.
    >
    > I event tried code 2 in the control.
    > What can i do?
    >
    > ---code 1
    > <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
    > <ContentTemplate>
    > <asp:Literal ID="LiteralTresci" runat="server" Mode="PassThrough"
    > EnableViewState="False"
    > Text="[Lokalizowany
    > Literal]"></asp:Literal><asp:ImageButton ID="EditButton"
    > runat="server" SkinID="PrzyciskEdycji"
    > OnClick="EditButton_Click" EnableViewState="false"
    > Visible="False" CausesValidation="False" />
    > <table runat="server" id="KontenerEdycji" visible="false"
    > style="border-collapse: collapse;
    > margin: 0; padding: 0; background-color: #ffff99; color: Black;
    > font-size: 10px;">
    > <tr>
    > <td style="height: 26px">
    > <asp:TextBox ID="EditTextBox" runat="server"
    > EnableViewState="False"></asp:TextBox>
    > <asp:LinkButton ID="AcceptBtn" runat="server"
    > OnClick="AcceptBtn_Click" CausesValidation="False">Apply</asp:LinkButton>
    > <asp:LinkButton ID="CancelBtn" runat="server"
    > OnClick="CancelBtn_Click" CausesValidation="False">Cancel</asp:LinkButton>
    >
    > </td>
    > </tr>
    > </table>
    > </ContentTemplate>
    > </asp:UpdatePanel>
    > ---/end code 1
    >
    >
    > ---code 2
    >
    > void Register(Control ct)
    > {
    > foreach (Control c in ct.Controls)
    > {
    >
    > this.Page.ClientScript.RegisterForEventValidation( c.UniqueID.ToString());
    > Register(c);
    > }
    >
    >
    > }
    >
    > protected override void Render(HtmlTextWriter writer)
    > {
    > Register(this);
    > base.Render(writer);
    > }
    >
    > ---/end code 2

    Jon Paal [MSMD] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139