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. XML / XSL
  4. Datagrid cannot displayed.

Datagrid cannot displayed.

Scheduled Pinned Locked Moved XML / XSL
questiondesignsysadmindebuggingxml
1 Posts 1 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.
  • D Offline
    D Offline
    DotNet
    wrote on last edited by
    #1

    Hie, All I want to display what is on the XML put on the datagrid at the same time, want a delete hyperlink to delete my user. How to do it? The Edit or Add function can ignore it or the best is delete it. Let's look at the coding. <%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Data" %> <%@ Page Language="VB" Inherits="System.Web.UI.Page" %> Delete User Account dim gXmlfile as string = "~/data/Users.xml" dim gXmlPath as string ' ================================= Sub Page_Load(Src As Object, E As EventArgs) gxmlpath = server.mappath( gXmlfile ) 'file is in same folder as page If Not (IsPostBack) DataLoad("UserEmail") End If End Sub ' ======================================== Sub DataLoad(parmsort as string) Dim ds As New DataSet Dim FS As New FileStream(Server.MapPath(gXmlFile), FileMode.Open) ds.ReadXml(FS) ' 02/14/02 pchu handle an empty file --------------------------- if ds.tables.count = 0 then ds.tables.add( MakeBooksTable() ) end if trace.warn ( "rowcount1 = " , cstr(ds.Tables(0).rows.count )) ' 02/14/02 pchu --------------------------- ' Add code to sort the dataview if parmsort is present 'ok let's get fancy and insert a blank row at the top dim sw1 as integer = 1 select case sw1 case 1 dim dr as datarow = ds.Tables(0).newrow() 'put something in the first column ISBN dr("UserEmail") = " Add UserEmail" ds.Tables(0).rows.insertat(dr, 0) trace.warn ( "rowcount2 = " , cstr(ds.Tables(0).rows.count )) end select 'create dv and bind it to datagrid dim dv as dataview dv = new DataView(ds.Tables(0)) if parmsort.length > 0 then dv.sort = parmsort end if MyDataGrid.DataSource = dv 'old MyDataGrid.DataSource = new DataView(ds.Tables(0)) ' 02/14/02 pchu --------------------------- MyDataGrid.DataBind() FS.close() END SUB ' ======================================== Sub DataSort(Src As Object, E As DataGridSortCommandEventArgs) ' Bug if we sort, then Edit Item Becomes Wrong IF MyDataGrid.EditItemIndex=-1 THEN DataLoad(e.sortexpression) ELSE response.write ("Can't sort until editing is done!") END IF End Sub Sub</x-turndown>

    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