Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. disable HTML tags in DataGrid Cells ( VS.Net 2003 )

disable HTML tags in DataGrid Cells ( VS.Net 2003 )

Scheduled Pinned Locked Moved C#
csharphtmlcssvisual-studiodesign
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ALAQUNAIBI
    wrote on last edited by
    #1

    Hi, Am trying to create a custom DataGrid control the only pursues of this controls is to disable the HTML tags to be drawn in grid cells. Am using VS.Net 2003 / C# This is the controls class using System; using System.Data; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.ComponentModel; using System.IO; namespace MyControl { /// /// Summary description for CustomDataGrid. /// [DefaultProperty("Text"), ToolboxData("<{0}:CustomDataGrid runat=server>")] public class CustomDataGrid: DataGrid { public CustomDataGrid() { base.CopyBaseAttributes( this ); } protected override void OnItemDataBound(DataGridItemEventArgs e) { foreach( TableCell tblCell in e.Item.Cells) { tblCell.Text = tblCell.Text.Replace(">", ">").Replace("<", "<"); } base.OnItemDataBound (e); } } } This is the HTML representation on the control on my ASPX Page <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="AspTest.WebForm1" %> <%@ Register TagPrefix="cc1" Namespace="MyControl" Assembly=" MyControl" %> WebForm1

    P 1 Reply Last reply
    0
    • A ALAQUNAIBI

      Hi, Am trying to create a custom DataGrid control the only pursues of this controls is to disable the HTML tags to be drawn in grid cells. Am using VS.Net 2003 / C# This is the controls class using System; using System.Data; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.ComponentModel; using System.IO; namespace MyControl { /// /// Summary description for CustomDataGrid. /// [DefaultProperty("Text"), ToolboxData("<{0}:CustomDataGrid runat=server>")] public class CustomDataGrid: DataGrid { public CustomDataGrid() { base.CopyBaseAttributes( this ); } protected override void OnItemDataBound(DataGridItemEventArgs e) { foreach( TableCell tblCell in e.Item.Cells) { tblCell.Text = tblCell.Text.Replace(">", ">").Replace("<", "<"); } base.OnItemDataBound (e); } } } This is the HTML representation on the control on my ASPX Page <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="AspTest.WebForm1" %> <%@ Register TagPrefix="cc1" Namespace="MyControl" Assembly=" MyControl" %> WebForm1

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      Your ASPX page code doesn't look right. Have you posted it correctly?

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      A 1 Reply Last reply
      0
      • P pmarfleet

        Your ASPX page code doesn't look right. Have you posted it correctly?

        Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

        A Offline
        A Offline
        ALAQUNAIBI
        wrote on last edited by
        #3

        <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="AspTest.WebForm1" %> <%@ Register TagPrefix="cc1" Namespace="MyControl" Assembly="MyControl" %> WebForm1

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups