.NET veiwstate problem

Results 1 to 2 of 2

Thread: .NET veiwstate problem

  1. #1
    Join Date
    Dec 1969

    Default .NET veiwstate problem

    Hello,<BR><BR>First I&#039;m just getting started in .NET / C# and basically re-writting old asp code to learn it.<BR><BR>I&#039;m having a problem with the viewstate and the innerhtml stuff. Below is some code accessing a databse (using codebehind) and putting the info in a datagrid. Then checking to see if it&#039;s empty or not, if it&#039;s empty storing that in the outError.Innerhtml as such.<BR><BR>What I&#039;m having a problem with is when the datagrid is empty it puts that inside the outError.Innerhtml, but when it is not empty, the viewstate of the page seems to store the outError.Innerhtml from the postback and dispalys it instead of the datagrid.<BR><BR>I have tried to set outError.Innerhtml to null, empty, and anything else I could think of. But nothing seems to work to clear it out so the datagrid info will show.<BR><BR><BR>Hope this makes since =)<BR><BR>Suggestions?<BR><BR>----------------------------------------------------------------<BR>string strSelect2 = "SELECT * FROM Documents WHERE FolderID = &#039;" + strID + "&#039; ORDER BY ImageDescription";<BR><BR>GetDocuments(strSelect2) ;<BR><BR>if (ListDocuments.Items.Count == 0)<BR>{<BR>outError.InnerHtml = "There are currently no Documents listed in the folder " + strFolderName + ".";<BR>}<BR>else<BR>{<BR>outError.InnerHtml = String.Empty;<BR>}<BR>----------------------------------------------------------------<BR>

  2. #2
    Join Date
    Dec 1969

    Default Post your HTML

    What is outError? A Label? A Literal? Have you tried <BR>outError.Text = "There are currently no Documents listed in the folder " + strFolderName + ".";<BR>instead?<BR><BR>

Posting Permissions

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