Hallo, danke.

> Du hast nun deine ArrayList initialisiert, aber nicht deren Eintr�ge...

Ich denke eigentlich doch: in der while - Schleife "ganz unten" (Assembly).
Daf�r lebt die Methode XmlDropDownList. Sie liest f�r mehreren Seiten des Projekts aus 
einer XML die Werte aus und legt sie f�r die jeweilige DropDownList in einer ArrayList 
ab. Geht vielleicht eleganter, aber das hat, glaub ich, erst einmal nichts mit der 
NullReferenceException zu tun ...


Der CodeBehind
.
.
using KiezAssembly;
.
.
.
void Page_Load()
 {
  string strPageName = "neuer Benutzer";
  ArrayList branchenListe = new ArrayList();
  KiezUtilities branList = new KiezUtilities();
  branList.XmlDropDownList(strPageName, 1, ref branchenListe);
 //
 // letzte Zeile f�hrt zu:
 // System.NullReferenceException:
 // Object reference not set to an instance of an object.

    ddlBranche.DataSource = branchenListe;
    ddlBranche.DataBind();
  }


Die Klasse in der Assembly:

using System;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web;
using System.Web.Mail;
using System.Xml;
using System.Xml.XPath;

namespace KiezAssembly
{
 public class KiezUtilities : Page  //HttpContext.Current.
  {
   string strPfad;
     .
     .
     .
   public void XmlDropDownList
   (string strPageName, byte byteEbene, ref ArrayList branchenListe)
     {
      strPfad = Server.MapPath(CreatePath(byteEbene)
                + "db\\KiezTageskarte.mdb");

        XPathDocument objXPathDoc;

       try
       {
        objXPathDoc = new XPathDocument(strPfad);
         }
         catch (Exception ex)
         {
         divFehlermeldung.InnerHtml =
       this.Fehlerseite(strPageName, ex.ToString(), 1);
         pnlFormular.Visible = false;
         this.SendMail(ex.ToString());
         return;
         }

         XPathNavigator objXPNav = objXPathDoc.CreateNavigator();
         XPathNodeIterator objXPIter;
         objXPIter = objXPNav.Select("descendant::Branche");

         while (objXPIter.MoveNext())
         {
          branchenListe.Add(objXPIter.Current.Value);
         }
     }


   }
}




| [aspdedotnet] als [email protected] subscribed
| http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.dotnetgerman.com/listen/aspDEdotnet.asp

Antwort per Email an