.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

Datalist doesn't appear to be working

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :ASP.Net
I am trying to get a datalist to work, so I can use it as a menu. This is a learning experience for me, and would like to figure it out. I sort of used the TimeTracker as an example. Anyway, I build the ArrayList as the DataList datasource, but it doesn't work. So I put in a DataGrid, and copied the setting and binding of the datasource, and it works. I'll copy the page_load code to show how I'm doing this. I'm not including the TabItem class, but it appears to be working, cause it works for the DataGrid. Can anyone explain what is going wrong. When I try to used the DataList, I get the following error in the browser:

Object reference not set to an instance of an object.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

And the following line is highlighted red:
Line 58: tabs.DataSource = menuItems;


public abstract class Banner : System.Web.UI.UserControl
protected System.Web.UI.WebControls.DataList tabs;
protected System.Web.UI.WebControls.DataList MenuList;
//protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Image Image1;

private void Page_Load(object sender, System.EventArgs e)

View Complete Post

More Related Resource Links

javascript function not working with datalist


I have a datalist and there is a check box within this datalist in a .ascx page.  But I have to have an image out side the datalist.  So here is the code and its not owrking.  When I click on the image, I dont see any alert box. 


<script Language="JavaScript" type="text/javascript">


function validate_checkbox()



// set var checkboxSelect to zero

var checkboxSelect = 0;

var sProducts = "";


var multiCheck = window.document.forms["frmCompare"].CompareCheck.length;


if (multiCheck != null)


    // Loop from zero to the one minus the number of checkbox button selections

    for (counter = 0; counter < window.document.forms["frmCompare"].CompareCheck.length; counter++)


        if (window.document.forms["frmCompare"].CompareCheck[counter].checked)


            var seperator = (checkboxSelect > 0)?",":"";

            sProducts += sep

Setting the SelectedIndex doesn't seem to be working

At least, it doesn't seem to work the way I would expect it to work, for the ComboBox.  Here's what I'm trying to do.  This is in a WPF 4.0 application, which I've made a page-oriented application.  (Not an XBAP app.)  On the first page the user enters a search criteria in an effort to find a client.  If they find a client, then the select that client and go to the second page.  If they don't find the client, then they still go to the second page, but they enter all of the information for a new client.  What I've done, with the second page is, with it's class constructor I'll pass in various parameters to indicate whether or not I'm working with a new client, or an existing client.  The majority of the time we're working with existing clients. It is the case where it is a new client that I'm having trouble.  On the second page there are several combo boxes, all of which I populate from lookup tables out of SQL Server.  All of the combo boxes are giving me the same problem/behavior, so it doesn't really matter which one I talk about.  Basically, for new clients, I want to set a pre-defined value for these combo boxes.  So, what I've done is in the second page's load event I'll set the SelectedIndex to the value our business has defined as the primary value, for new clients, for the various fields tha

DataList doesn't load some of the times - hit or miss

This is the problem.  My datalist, which connects to an Objectdatasource (I implemented custom paging) becomes populated with data only half of the time.  When I go to the aspx page which contains that datalist (from another page), sometimes, the datalist fully loads, but sometimes only the header shows up.  The header just contains hard-coded text whereas the body (itemtemplate portion) contains things that are binded to the objectdatasource.  I thought I would mention this since the problem might have something to do with how things in asp.net bind.The strange part of this is that when I was testing and debugging within VWD 2010, the datalist loaded fully everytime and I had no issues.  When I placed my files on the IIS web server, this is when the problems started happening.What could the problem be?  The speed of the IIS web server vs VWD's "internal server"?  My page_load, init_load, etc methods are empty for this aspx page.  The datalist is solely handled by the objectdatasource_selecting method.  Should I explicit call something from one of those early lifecycle methods to ensure proper datalist loading?Thanks in advance.

PagingBulletedListExtender is not working with Datalist



I am using PagingBulletedListExtender with asp.net bulletList Control and i want to display my data in multi column but BulletList Control Doesn't have a property for multi Column so please tell me what i have to do for multi column.

i m sending Code--

<asp:BulletedList ID="BulletedList1" runat="server" DataSourceID="srcCity" CssClass="ListStyle"
                            DataTextField="City" AppendDataBoundItems="true" DataValueField="City" DisplayMode="LinkButton"
                        <cc1:PagingBulletedListExtender ID="PagingBulletedListExtender1" runat="server" Clien

Why doesn't the Windows authentication working?


I'm trying to write a simple ASP.NET 4.0 app, using Windows authentication to login.  This is on my peer-to-peer home network.  When I click to login, it instantly shows my Windows identity, so it looks as though I don't even need to login, as it's already done that for me.  However when I then go to any other page in the app, it looks as though I'm not logged in.

Why is that and how do I fix it? 

Working with SharePoint document libraries

Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office 2003 can check out and edit the files as if they resided on a local or network drive.

By default, your team Web site comes with a built-in document library named Shared Documents, which is listed on the Quick Launch bar as well as on the Documents and Lists page.

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

Server side validation of Fileupload control not working



I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.

Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

Row command working on all rows not selected one?



I have this code that hides a column in a gridview.  (The column houses another nested gridview).

    Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        If e.CommandName = "Select" Then
            If GridView1.Columns(0).Visible = False Then
                GridView1.Columns(0).Visible = True
                GridView1.Columns(0).Visible = False
            End If
        End If
    End Sub

The trouble is that if I click the select link on one row that action to hide is carried out on all rows.  How can I set this up so that it only hides the row that is selected?


upload file not working



iam using masterpage and ajax update panel, i have child page called  fileupload.aspx,i try to upload the file

but its not working , can i use updatepanel in child page , pls very urgent

looking forward for answer.

Beginner: this doesn't make sense to me


Do you need and "empty" script tag in the head to run scripts that are in the body?  Also, can you run JQuery scripts if they're in the <head> tag?  The first sample only works if the JQuery script is in the form (and body) tag, not in the head - even if I add $(document).ready(function() { });

This works

<head runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" />
<script type="text/javascript">
<form id="form1" runat="server">
<a href="">Here is a link</a>
<script type="text/javascript">
$('a').click(function () {
alert("you clicked me!");


This doesn't work.  Notice I removed the second <script> tag from the head

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="serve

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.

datalist image slide show problem


hi friends

i am binding  images dynamically(back end)for a datalist .iam applying a slideshow for it .I am getting a problem to apply slideshow for dyanmically binded images.If the define in a div statically it working perfectly

for example pls go through my code below:

<script type="text/javascript">
$(document).ready(function() {
        fx: 'scrollLeft' // choose your transition type, ex: fade, scrollUp, shuffle, etc...

<div class="slideshow">
        <img src="images/30_dummy.jpg" width="200" height="200" />
        <img src="images/aquarius.gif" width="200" height="200" />
        <img src="images/star.gif" width="200" height="200" />
        <img src="images/the-proud-indian-flag-1.jpg" width="200" height="200" />

I above code works perfectly and the slide show e

jquery confirm windows isn't working


Hi, i am using jquery to implement a modal confirm windows but it not working

i have a template field button with ajax confirm using jquery but i have a problem. Apper the confirm windows but when i click on "yes" doesn't execute the delete command. without ajax (using template field button and simple confirm windows javascript) works so well.

Can you give me a hand with this?

thx in advance!

<link href="_assets/css/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="_assets/css/confirm.css" rel="stylesheet" type="text/css" />
<script src="_assets/js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="_assets/js/jquery.simplemodal-1.1.1.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
       $(".deleteCustomer").click(function(ev) {
                var msg = $(this).attr("title");
                confirm(msg + "?");

Keyboard shortcuts stops working in WebMatrix


I'm often experiencing that keyboard shortcuts stops working in WebMatrix. This is very annoying as CTRL-S, CTRL-C, CTRL-V, etc. stops working, all of which are heavily used when programming. It's obviously hard to explain how to reproduce this, but I was wondering if someone knows a quick-fix?

update/delete not working on server only


my aspx page works in VWD, and everything works on the server EXCEPT update and delete sql functions. any ideas?


New off line application working with sdf file. Need advice


Hey Folks

I am working on a project currently where I need to get data out of a 3rd party vendor's software that uses a .sdf file I looked this up and its a SQL CE file. I was hoping to just link to with with access but thats apparently not going to happen. I need to link to the database extract data from it to a csv file for later use. I also and most important I need to get the data from it and create a report that can be printed while on a customers site that my or may not have web access so I need for this program to be on and off line. I had my webapplication that I have been working on open and was able to bring up the sdf file under the server exploere however I can't seem to get anything out of it when I try to do grid views or detail views errors out.

Can I use one of Visual Studio projects to create this sort of applicaiton if so what would be the best approach. I would love to get an access odbc driver since office is allready installed on the employee's laptop's



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