Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5988831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:00:52+00:00 2026-05-22T23:00:52+00:00

im trying to edit a field using code instead of the wizard. im not

  • 0

im trying to edit a field using code instead of the wizard. im not entirely sure if the code i have is correct to update the field. here is the code i have to edit the field:

 Protected Sub ListView1_ItemEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewEditEventArgs) Handles ListView1.ItemEditing
    ListView1.EditIndex = e.NewEditIndex
    ListView1.DataBind()
End Sub

Protected Sub ListView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewUpdateEventArgs) Handles ListView1.ItemUpdating
    Dim profile = Request.QueryString("Profile")
    Dim postid As Label = DirectCast(ListView1.EditItem.FindControl("postId"), Label)
    Dim textbox As TextBox = DirectCast(ListView1.EditItem.FindControl("EditPostTxt"), TextBox)
    Dim getComment = (From p In db.Posts Where p.PostId = New Guid(postid.Text)).Single

    getComment.Post = cc.reverseExchangeSmilies(textbox.Text)
    db.SubmitChanges()

    ListView1.EditIndex = -1
    cc.LoadComments(profile, ListView1)
End Sub

when ever i try to ether update or cancel the post because the post contains html i get the following error:

A potentially dangerous Request.Form value was detected from the client 

i was wondering if before it updated the post it could use the reverseExchangeSmilies to turn them back in to smiles instead of there html or maybe allow html to be used at this point.

aspx page:

<asp:ListView ID="ListView1" runat="server">
                                    <ItemTemplate>
                                        <div id="header">

                                            <asp:HyperLink ID="UserPageLik" runat="server" NavigateUrl='<%#"Default.aspx?Profile=" + Eval("ProfileId") %>'> <%# Eval("fullname")%> </asp:HyperLink><br />
                                        </div>
                                        <div id="leftcolumn">
                                            <asp:ImageButton ID="Image1" runat="server" ImageUrl='<%#Eval("DisaplyPictureSmall") %>' /></div>
                                        <div id="content">
                                            <asp:Label ID="Label4" runat="server" Text='<%#Eval("Post") %>'></asp:Label><br />
                                        </div>
                                        <div id="footer">
                                            <%# Eval("Date")%><br />
                                            <asp:linkbutton id="linkbutton1" runat="server" CommandName="del" CommandArgument='<%# Eval("PostId") %>' forecolor="red" text="Delete" onclientclick="return confirm('Are you sure?');" />
                                             <asp:linkbutton id="linkbutton2" runat="server" CommandName="Edit" CommandArgument='<%# Eval("PostId") %>' forecolor="red" text="Edit" />
                                        </div>
                                        <br />
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                    <div id="header">
                                        <asp:Label ID="postId" runat="server" Text='<%#Eval("PostId") %>'></asp:Label>
                                            <asp:HyperLink ID="UserPageLik" runat="server" NavigateUrl='<%#"Default.aspx?Profile=" + Eval("ProfileId") %>'> <%# Eval("fullname")%> </asp:HyperLink><br />
                                        </div>
                                        <div id="leftcolumn">
                                            <asp:ImageButton ID="Image1" runat="server" ImageUrl='<%#Eval("DisaplyPictureSmall") %>' /></div>
                                        <div id="content">
                                            <asp:TextBox ID="EditPostTxt" runat="server" Text='<%#Eval("Post") %>' Width="100%" TextMode="MultiLine"></asp:TextBox>
                                        </div>
                                        <div id="footer">
                                            <%# Eval("Date")%><br />
                                             <asp:linkbutton id="SaveEditBut" runat="server" CommandName="Update" CommandArgument='<%# Eval("PostId") %>' forecolor="red" text="Update" />
                                             <asp:linkbutton id="Linkbutton3" runat="server" CommandName="Cancel" CommandArgument='<%# Eval("PostId") %>' forecolor="red" text="Cancel" />
                                        </div>
                                        <br />
                                    </EditItemTemplate>
                                </asp:ListView>

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:00:53+00:00Added an answer on May 22, 2026 at 11:00 pm

    The framework is preventing you from posting html code as a security measure. This can be turned off for the current page by adding a page directive.

    <%@ Page validateRequest="false" %>
    

    The other option is to use javascript on the client side to change ‘<‘ to < and ‘>’ to > and ‘&’ to & before posting. Then on the server side you could decode the html before writing it to the screen.

    function encodeValue(element_id) 
    {   
        var elem = document.getElementById(element_id);
        var html = elem.value;
        html= html.replace(/&/gi,"&amp;");
        html= html.replace(/</gi,"&lt;");
        html= html.replace(/>/gi,"&gt;");
        elem.value = html;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ExtJs4 and I'm trying to extend the Ext.form.field.ComboBox like below: Ext.define('GenericCombo', {
I'm trying to edit the output joomla main_menu module so I can make a
I am trying to get the Edit with Vim context menu to open files
I'm trying to determine how to open/edit existing SQL Server Reporting Services (SSRS) 2005
I'm trying to convert an openGL [edit: card that I drew(?):) thx unwind]containing a
I'm trying to load a page that is basically an edit form inside a
I'm trying to single source a form page which can be in edit mode
Edit--@Uri correctly pointed out that this was an abuse of annotations; trying to actually
I have been looking at nestedSet behaviour in symfony using doctrine, to display a
I'm trying to talk to Fax server software using an email. The fax server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.