Results 1 to 4 of 4

Thread: would some kind soul write me two aspx pages?

  1. #1
    Join Date
    Oct 2003

    would some kind soul write me two aspx pages?

    page1.aspx - has a single hypertext column data grid that lists employees sorted by last name.
    hyperlink.text = firstName & " " & middleName & lastName 'middleName has a trailing space.
    hyperlink.href = "page2.aspx?empId="&employeeId

    page2.aspx - has a single record form with textboxes per field that displays the record chosen on page1.aspx and allows the record to be updated.

    I'm new to asp.net but I'm very confident I could handle this if the data source was an SQL database, however, and heres the kicker, here is my data source:

    <?xml version="1.0" encoding="iso-8859-1"?>

    <employee Id="i100">
    <workPhoneId extension="531">p1</workPhoneId>


    everything that Iíve been reading seems too convoluted and complex to be realistic. Isn't there some plain and simple way to accomplish this? I'll take any TIDs or howTo docs anyone can throw my way. Ultimately, I want to add records and delete them as well. Thanks in advance.

    Last edited by lcscne; 04-08-2005 at 03:40 PM.

  2. #2
    Join Date
    Sep 2004
    Northeast, FL
    This is pretty plain and simple and not too complex. I'd be willing to write them for you for a trade of cash or services! Otherwise, here are some tips on how to approach it.

    First, create an object to handle an employee record. Properties for each employee attribute and methods to handle fetching, inserting, and deleting records, etc.

    Then, look into the XmlTextReader and XmlTextWriter to handle the reading and writing of your xml file, which you'll use in your fetch, insert, update, and delete methods.

    The idea is that you'll use the XmlTextReader to stuff employee objects for each employee and put them into a collection. Then display that collection on Page1.aspx with a datagrid or literal control or whatever.

    On Page2.aspx, you'll get the employeeId from the querystring and then use a method in your employee object to stuff an employee object with the record that matches the EmployeeId. Then you'll use that new object to fill your form elements. Once the user clicks submit, you'll update the employee record based on the employeeId. Use a similar approach for insert and deletes too.

    Also, you'll need to grant the read/write permission on the XML file to the user that your application is running as. Ie. "ASPNET"

    Let me know if you have any questions or some example code. I think I have some code for reading/writing to XML files.

  3. #3
    Join Date
    Oct 2003
    Thanks CStick,

    As a test I'm trying to extract the value stored in the Id attribute for a given employeeId here is my function which will set all the employee properties for the class if I can harvest the stinkin id attribute. I know it seems stupid to harvest the id attribute with it being the argument to the function but like I said this is just a test to see if I'm able to harvest anything from the xml file. All I'm getting when I read the classname.emplyeeId is empty string. If I create a line outside the While loop that states "Me.employeeId = 112233" and then read the employeeId property it works fine. Please help

    ...class properties declared here

    Public function fetchEmployee(empId As String) As Integer
    Dim recordsAffected As Integer = -1
    Dim objReader As New XmlTextReader(employeeXmlFile)

    While objReader.Read()
    If objReader.NodeType = XmlNodeType.Element Then
    If objReader.Value = "employee" Then
    If objReader.Value = empId Then
    Me.employeeId = objReader.Text
    recordsAffected = 1
    End If
    End If
    End If
    End While

    return recordsAffected

    end function

    xml file
    <?xml version="1.0" encoding="iso-8859-1"?>
    <employees xmlns="http://www.mydom.org/employees" xmlns:lcsGlobals="http://www.mydom.org/globals" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mydom.org/employees employees.xsd">

    <employee Id="i100">
    <lcsGlobals:workPhoneId extension="531">p1</lcsGlobals:workPhoneId>


  4. #4
    Join Date
    Sep 2004
    Northeast, FL
    Here's some code that should get you moving a little more. Ask if you need more help.

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim strAr As System.Collections.Specialized.NameValueCollection = fetchEmployee("i100")
            For i As Integer = 0 To strAr.Count - 1
                Response.Write(strAr.GetKey(i) & " | " & strAr.Item(i).ToString & "<br />" & vbCrLf)
        End Sub
        Public Function fetchEmployee(ByVal empId As String) As System.Collections.Specialized.NameValueCollection
            Dim strAr As New System.Collections.Specialized.NameValueCollection
            Dim str As System.IO.Stream = System.IO.File.Open(Server.MapPath("employees.xml"), IO.FileMode.Open)
            Dim objReader As New XmlTextReader(str)
            objReader.WhitespaceHandling = WhitespaceHandling.None
            While Not objReader.GetAttribute("Id") = empId
            End While
            While Not objReader.Name = "employee"
                Dim name As String = objReader.Name
                Dim value As String = objReader.ReadInnerXml
                strAr.Add(name, value)
            End While
            fetchEmployee = strAr
        End Function

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.16137 seconds
  • Memory Usage 2,869KB
  • Queries Executed 13 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates