Posts Tagged ‘C#’

Recently I have observed that listbox scrollbar has virtualization problem when we re-bind listbox. Let me explain this with an example.

I have added 50 items into listbox control programmatically. Here is the screenshot for the same.

Image after 50 Items bound to listbox

Normal Listbox Binding

Re-bind listbox

Re-bind button click without scroll bar move

As you can see I have added two buttons to Reset and to Re-bind listbox again.

If I click on any of the button everything will work as expected but real problem is when we move scroll bar to bottom of the listbox and we re-bind listbox data.

See what kind of problem you shall face.

Problem displaying data

Solution :

Use scrolltoview function after assigning ItemsSource to listbox. See code snippet below.

 List<ListBoxItem> a=GetItemsList(txt,count);

listbox1.ItemsSource = a;






Read Full Post »

This is common JavaScript error occurred while working with asp.net. I have faced this problem numerous times and believe me this is really very cumbersome error. This error occurs because of badly written JavaScript or due to access permission to the particular file, folder or image(s). Sometimes in your code if you have written path which does not exist in your .net web application. This kind error may occur. Friends, I have got this error many times and trust me each and every time its tuff to find where the problem is. Even my colleagues got this kind error many times. I have searched a lot about this error on Internet but not able to find the exact solution. Everybody is saying that it’s because of unclosed quotation mark in JavaScript. It’s true but not in every case.
In addition, what happens sometime you may not get this error while you work locally and the time when you deploy it to web-server you will get ‘unterminated string constant’ error. Am I correct ?
Here are the checklists/suggestions to resolve this error.
  1. Check you javascript for unclosed quotation mark. Check inline as well as reference JavaScript file. Starts with inline JavaScript.

  3. Give proper permission (rights) to directory under which your aspx page laying. Ex. Rights for IIS user, ASP.net process.

  5. Also check permission (rights) for image directory, if you are working with images.

  7. Check for the hard coded path in the CS(Class file in C#) ,if any, check existence for the path.



I hope the solutions above might be useful to resolve unterminated string constants error.

Read Full Post »