.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

TreeView Empty Leaf cause error

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net

 I have a treeview that shows 'Deals'>DocumentType>DocumentFileName

If there is no documentFileName In a particular DocumentType it causes a javascript error.

How do I avoid this. Thanks.

Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Collections
Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Class DealDocs
    ' From http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/ctrlref/navigation/TreeView/TreeView11.src&file=TreeViewDatabase_vb\App_Code\WarehouseDB.vb&lang=VB+Source

    Public Shared Function GetDocTypes() As doctypeList

        Dim doctypes As New doctypeList

        Dim connStr As String = ConfigurationManager.ConnectionStrings("DB_6056_securedeConnectionString").ConnectionString
        Dim mySource As SqlDataSource = New SqlDataSource(connStr, "procGetDocTypes")
        mySource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure

        Dim result As IEnumerable = mySource.Select(DataSourceSelectArguments.Empty)

        Dim row As DataRowView
        For Each row In result

            doctypes.Add(New doctype( _
                row("DocTypeId").ToString(), _

View Complete Post

More Related Resource Links

Using Error Provider with TreeView?

Can the standard error provider (icon) be used on Treeview nodes? I have one parent node with one child, I want to show the icon next to the parent only and remove the + and - images . Working with VB .NET, but can use a C# example. Thanks much!   

error in MVC2 on empty string form fields which are required: "This property cannot be set to a null

In model I have:[DisplayName("ISBN")] [Required(ErrorMessage = "ISBN is required.")] [StringLength(50, ErrorMessage = "ISBN book must have max {1} chars.")] [DisplayFormat(ConvertEmptyStringToNull = false)] public string isbn { get; set; }But when I submit form with empty field ISBN I have an error - ConstraintException: This property cannot be set to a null value.I have find that other people have the same problem and they say that debbugger in VS2010 works wrong - yes ?http://p2p.wrox.com/book-professional-asp-net-mvc-2/79788-constraintexception-unhandled-user-code.html#post259245http://efreedom.com/Question/1-3129080/Server-Side-Validation-REQUIRED-String-Property-MVC2-Entity-Framework-Workhttp://mvcmusicstore.codeplex.com/workitem/6604

JPEGS with empty IPTC / APP14 Tags cause GDI+ error

I am curious as to why the GDI+ libraries error our with exc = {"A generic error occurred in GDI+."} when the IPTC headers are empty.  I would assume it should reasonably take care of this.  I have taken am image and changed the "ff ed" app14 marker to more generic "ff ec" and everything loads fine and dandy.  So by analysis I am looking at a jpg the IPTC header has no data and I am guessing the GDI+ libraries dont handle empty data very well.  Anyone else having this problem.  Only workaround which is expensive is creating a new image and saving it to the stream which in a sense basically strips the header data making it more generic of an image.   System.Drawing.Image image = Image.FromFile("c:\\test6.jpg"); System.Drawing.Image image2 = null; ImageFormat format = ImageFormat.Jpeg; using (var stream = new MemoryStream()) { try { image.Save(stream, format); //using jpg with empty IPTC data will throw GDI+ error } catch (Exception exc) { image2 = new Bitmap(image);//this is expensive but gets job done image2.Save(stream, format); } context.HttpContext.Response.BinaryWrite(stream.ToArray()); } JPG Hex Bytes from beginning of file.  The Internal of the stream will error out about 24 bytes with a lengt

IE script error (object expected) on treeview

Hi,Just starting out with the CSS adapters and have implemented a treeview. Works fine in Firefox butIE shows a script error (bottom left) when moving over the tree view. It still goes to the page but there is obviously an issuePage code is in a master page below is the source view in IE<script type="text/javascript">//<![CDATA[var theForm = document.forms['aspnetForm'];if (!theForm) {    theForm = document.aspnetForm;}function __doPostBack(eventTarget, eventArgument) {    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {        theForm.__EVENTTARGET.value = eventTarget;        theForm.__EVENTARGUMENT.value = eventArgument;        theForm.submit();    }}//]]></script><script src="/countrystovesdirect/WebResource.axd?d=KFBAefcFIGtf1hLcg-tm2g2&amp;t=634172878000000000" type="text/javascript"></script><script src="/countrystovesdirect/WebResource.axd?d=S53dmqAagvRk26h8P3H5I9pat_c17l9dW6l04Xdzs9Ai0yVsPFqiIf_M-ylpvzDHp0GeDDnhMnCondcznfbzzw2&amp;t=634201551800000000" type="text/javascript"></script><script src="/countrystovesdirect/WebResource.axd?d=S53dmqAagvRk26h8P3H5I9pat_c17l9dW6l04Xdzs9ACFhsw16G3-NkgCeZFVUFx6W

Display error if a treeview root node contains a child node

I am having a treeview initially with a root node when form is loaded. I will add child node as some.txt file at the runtime by selecting an option as Addnew from contextmenu which was displayed when the user right clicks on the root node. Now what i need is if the tree has child node appended to the Root and if user tries to create a new node by clicking the option addnew from context menu i would like to display an error as only one child allowed.   Can any one help

How to show label when TreeView is empty?


Sometimes I feel that DataBinding and Triggers defined in xaml is just trying to fight me.

I have this really simple case where I have a UserControl with a TreeView and a TextBlock. I want to show the TextBlock only when the TreeView is empty.

In code this would be one or two lines of code, but I’m determined to hook it up in xaml, but so far, no matter what I try it doesn’t work.


I even tried to expose the Items as a property on the control class itself – but I could bind to that either.


How would you do this in xaml ?





How to resolve this error? - Database on SQL Server instance is not empty and does not match current

Upgrade form MOSS 2007 to Sharepoint 2010.  Reviewing the event log I see the following error.  Not sure what to do and hoping someone can provide some guidance please.

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name

Receiving a fatal error 3624 @pageref.cpp:913 inserting into an empty table


Hi guys,

I'm using Integration Services to insert rows into a SQL Server 2008 table, and I'm receiving an error - only when the table is empty before the insert.  I use SSIS quite frequently, and this is the first time I've seen this kind of issue.  Since I'm getting some internal errors that seem related to the engine in the reports, I figured I'd post here for ideas.

Here's the dump from the Agent job that runs the package:

Executed as user: CORP\_DWAdmin_Service. Microsoft (R) SQL Server Execute Package Utility  Version 10.0.2531.0 for 64-bit  Copyright (C) Microsoft Corp 1984-2005. All rights reserved.    Started:  8:38:29 PM  Error: 2010-10-11 20:39:14.14     Code: 0xC0202009     Source: Insert New Records DIM_CUSTOMER [6]     Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.  An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80004005  Description: "Warning: Fatal error 3624 occurred at Oct 11 2010  8:39PM. Note the error and time, and contact your system administrator.".  An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x800

Report Builder returning #Error value in empty fields and working with Date field


Hey guys,

I am trying to build a report using the date field from CRM and only wanting to return the date I am using this expression "=Fields!new_date.Value.ToShortDateString()" but when there is an empty fiel I get #Error. How do I solve this?

Also is there anyway to return the date field with the actual month showing instead of the numerical value? i.e. instead of 1/31/2010 Have it show January 31, 2010 (Doesn't have to be exactly in that format, but want the name value for the month.)

IE script error (object expected) on treeview



Just starting out with the CSS adapters and have implemented a treeview. Works fine in Firefox but
IE shows a script error (bottom left) when moving over the tree view. It still goes to the page but there is obviously an issue

Page code is in a master page below is the source view in IE

<script type="text/javascript">
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;

<script src="/countrystovesdirect/WebResource.axd?d=KFBAefcFIGtf1hLcg-tm2g2&amp;t=634172878000000000" type="text/javascript"></script>

<script src="/countrystovesdirect/WebResource.axd?d=S53dmqAagvRk26h8P3H5I9pat_c17l9dW6l04Xdzs9Ai0yVsPFqiIf_M-ylpvzDHp0GeDDnhMnCondcznfbzzw2&amp;t=634201551800000000" type="text/javascript"></script>
<script src="/countrystovesdirect/WebResource.axd?d=S53dmqAagvR

Webpart causing authentication error when cache is empty - showing just fine, when a lokal admin has



I'm having some trouble with a webpart and some rights, I think.

I have created a webpart, showing some data from at database. Based on which Active Directory group the user is in, some part of the webpart is either show or hidden.

My problem is now, that every morning, the webpart causes an error, saying you need to logon. When I open the same page from the local machine with a local admin, the webpart shows up, and the webpart is now show as it should for everyone.
This behaviour happens next morning.

The webpart is deployed to the GAC.
I also sometimes se the problem when a user, who is in a group that enables them to se the "add comment" part of my webpart, they get the error, but the user, which are NOT allowed to se the "add comment" part see the webpart just fine.

I hope it is clear, what my problem is, but I will gladly try to explain deeper, what the issue is.


IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"


Handling 404 page not found with Error page



      How do i handle 404 page not found?

Inserting personal error message in ValidationSummary



I am creating a web form that requires a lot of validation. I use many of the validation control in asp.net already like RequiredFieldValidator and CompareValidator. 

My Problem: after my custom validation for the value entered return an error message, and I pressed enter key when the field is empty, my custom error message is overlapped by my ValidationSummary. 

Setting my custom error to visible = false on button click also does not seem to work as it requires for me to enter the value first.

This made me think, is there a way to insert my custom validation inside the ValidationSummary as an error message like for other validation control?

Thanks in advance

Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

        public static string aaa(int i)
            return i.ToString();

        public static string aaa1(int i)
            return i.ToString();



        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        <span id="displayspan"></span>
        <br />
        <input type="button" value=

JQuery Treeview plugin is not working with Ajax page load in ie8


Hi there,

I developed a page where i m using jquery treeview plugin to generate tree. It worked fine on FF, IE8 with out ajax.

But when my page loads thro' ajax call in IE8, it is not collapsing or expanding tree.

Any idea?

Thanks in advance.

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend