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. Web Development
  3. ASP.NET
  4. Need line break and hyper link in GridView

Need line break and hyper link in GridView

Scheduled Pinned Locked Moved ASP.NET
help
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
    AS 13
    wrote on last edited by
    #1

    Hello everybody, i have two issues.. in my application I have DataTable which contain all the values.My dataTable contain 3 columns and rows depend on the data.Later on I assign the datatable to a gridview. I want to put line break in the last column of the Gridview and in the 2nd column i need the data should be hyperlink to a pgeUrl. i use VS2005 plz help me out..

    A key to every Solution

    J 1 Reply Last reply
    0
    • A AS 13

      Hello everybody, i have two issues.. in my application I have DataTable which contain all the values.My dataTable contain 3 columns and rows depend on the data.Later on I assign the datatable to a gridview. I want to put line break in the last column of the Gridview and in the 2nd column i need the data should be hyperlink to a pgeUrl. i use VS2005 plz help me out..

      A key to every Solution

      J Offline
      J Offline
      John ph
      wrote on last edited by
      #2

      For a new line break you can use this syntax in the inline code DataBinder.Eval(Container.DataItem, "ColName").ToString().Replace(Environment.NewLine,"<br/>") For a Hyperlink Column on the Gridview control, you can check the sample code Here[^]

      - Regards -
         JON


      Life is not measured by the amount of breaths we take, but by the moments that take our breath away.


      A 1 Reply Last reply
      0
      • J John ph

        For a new line break you can use this syntax in the inline code DataBinder.Eval(Container.DataItem, "ColName").ToString().Replace(Environment.NewLine,"<br/>") For a Hyperlink Column on the Gridview control, you can check the sample code Here[^]

        - Regards -
           JON


        Life is not measured by the amount of breaths we take, but by the moments that take our breath away.


        A Offline
        A Offline
        AS 13
        wrote on last edited by
        #3

        where I v to writhe the code before bind the datasource or in aspx page. my code is as below DataColumn dcol = new DataColumn(Var_ColumnName1, typeof(System.String)); subsGift_DataTable.Columns.Add(dcol); lke other two column.. DataRow dr_Gift = subsGift_DataTable.NewRow(); dr_Datarow[Var_ColumnName1] = "SomeValue"); dr_Datarow[Var_ColumnName2] = SomeValue2; dr_Datarow[Var_ColumnName3] =" Name: Address: PhoneNo: "; subsGift_DataTable.Rows.Add(dr_Gift); MyGridView.DataSource = subsGift_DataTable; MyGridView.DataBind(); I need data shown in Column3 in linebreak like Name: Address: PhoneNo: and the address sould be hyperlink..

        A key to every Solution

        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