.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

there are some problem in finding the index of listview

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

how we find the listview index of row in case of item databind

View Complete Post

More Related Resource Links

SharePoint Calendar Error: The "ListViewWebPart" Web Part appears to be causing a problem. Index was

In one specific SharePoint calendar, on one specific week in that calendar when we select the "more items" link in the monthly view (or the expand all option) we get the following error:
The "ListViewWebPart" Web Part appears to be causing a problem. Index was outside the bounds of the array.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.
Troubleshoot issues with Windows SharePoint Services.

If we select a different week the expand and collapse works fine in that calendar.

Nested listview fk-problem with insert



My problem is this, i have a nested listview that works fine but if i need to do an insert and the nested listview dont have retrived any values (that is no posts created) i cant get hold of the fk that i need. If i put a hiddenfield in the parents listview with the fk how can i find it in codebehind when i do an insert? 



A layout, mouse selection, ListView problem/question

I'm having a problem with a particular layout scenario, and how it interacts with a left mouse click in certain situations. I have 3 rows in a Grid.  The first is a ListView (Master), with the Row Height set to '*'. It's ItemSource is bound to a collection in a ViewModel, and its SelectedItem is bound to a value in the ViewModel.  When the SelectedItem is null, it should take up its entire container (the other 2 rows are invisible). The second row is the GridSplitter.  It's visibility is bound to a value in the ViewModel.  It's only visible when the SelectedItem in the Master ListView is not null.  It's GridRow height is set to Auto, and it's height is explicitly set to 5 (via a style). The third row is a sub-ListView that shows Detail data for the Master SelectedItem in the top ListView.  It's GridRow Height is set to zero by default, and if an item is selected in the Master ListView, it should become visible and have a set height (400 to start, via a binding on the Height of the row). The desired effect is that when an item is selected in the Master ListView, the Detail ListView becomes visible and the GridSplitter allows you to resize the top and bottom as needed.  If necessary, the ScrollBars become visible in the Master ListView to show any items that are now obscured by the Detail ListView (via the automatic scrolling featur

Problem with listview selection

I have the following problem (which I have seen documented in many places with no solution).  I populate a listview.  The steps I use are: Set the ItemsSource to nothing (VB) Set the ItemsSource to the collection to be bound to Set the selected item to nothing (VB) Set the selected item to the first item in the collection The problem is that when I use the down arrow key to change selection in the listview, the first time I use the down arrow nothing happens.  After that first glitch everything works.  I have seen many "solutions" but none that work. Any ideas?? Thanks LLoyd Sheen

SQL Insert with Index Scan Problem....

Hi,   I'm having a very strange problem when inserting rows into a table. Let me try to explain a little better: Table1 (for example Book) with a lot of fields and one foreign key to Table2 (idVolume) and a primary key (identity - idBook). This table has a clustered index only on the primary Key. (this table has something like 10 Millions rows) Table2 (for example Volume) with a lot of fields and a primary key (idVolume) identity. (this table has hundreds of rows)   Now, the problem starts when I make a insertion on Table2. When I made an insertion, it was taking minutes to finish, so I stopped it. After looking into the execution plan of the query, there was something very very strange, there seems to be a clustered index scan on Table1... the problem is that since Table1 has so many rows, this index scan takes forever... Can anyone explain me why does the insertion on Table2 makes an clustered index scan on Table1? It really doesn't make any sense to me.   Thanks in advance. João Teixeira

Problem with ListView and SelectionMode="Single"

  I have the following XAML: <Grid>       <ListView SelectionMode="Single" Height="100" HorizontalAlignment="Left" Margin="26,118,0,0" Name="listBox1" VerticalAlignment="Top" Width="120">       <ListView.View>       <GridView>       <GridViewColumn Header="Test"/>       </GridView>       </ListView.View>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       </ListView>       </Grid>       Just a stock ListView with SelectionMode="Single". Isn't SelectionMode="Single" supposed to be single selection mode? There seems to be a lot of weird stuff with the Ctrl-Key. I tested the same behavior in a standard W

Index droping problem in SSIS package?

Hi All, I have one ssis package. After load the staging data I am creating index in one column. I am dropping the index end of package. But sometimes after create the index if I got any error I need to re run the package, already index is created so that’s why  once again I will get a error. So that purpose drop index statement I used before create index sqltask.If the first time package runs the table don’t have index. If the table have index it will drop the index otherwise it will skip that task. I used below code. But I am getting the error index is not dropped properly. IF EXISTS (SELECT name FROM sys.indexes WHERE name =   N'IND1_TRAN_DT ')  DROP INDEX  IND1_TRAN_DT  ON SLS_STNT_DTL_STGNG;   Thanks CMK

Listview WebPart Selectedview problem

We have a problem with the Listview WebPart on our current project.Situation:We are building custom sitedefinitions for a portal site. In these site definition we add our webpart/features that have to be deployed with this sitedefinition.In that defintion (ONET.xml) we add a ListViewWebPart on the page. <View List="Whiteboard" BaseViewID="3" WebPartZoneID="Left" WebPartOrder="2"    Type="108" /> Sofar everything is going fine, we generate our webs with the definition and the webpart renders like it should on the page.We then add an item in the list (Discussion list). Again sofar everything fine. when we then try to click on the item to view it in the webpart the item seems to magically disappear from within the webpart. However the items stays in the list so it's not like it gets deleted.After some searching we found out that when we bind the selectedview on the webpart again (modify shared webpart -> selected view) the item reappears just as magically as it disappeared.The problem is that for our project we have to create more then 90 webs with this sitedefinition and it's not an option manually start clicking every web for this "bug".Whe tried two other ways to solve this problem without success.First way was to remove the listviewwebpart declaration from the ONET and add the webpart with C# code in

Finding a control inside a ListView on a master page

I have a listview on a master page that ISN'T part of a content place holder that I want to fill in and disable if the user is already logged in. I have a label set up already which works fine. I'm just having problems accessing a Textbox by the name of "NameTextBox" in the InsertItem template of the listview.Here is the part of my codefile:Dim vCurrentUser As MembershipUser = Membership.GetUser() If Not vCurrentUser Is Nothing Then Dim pnl As Label = LoginView1.FindControl("Label1") pnl.Text = Page.User.Identity.Name Dim NameBox As TextBox = ListView1.InsertItem.FindControl("NameTextBox") NameBox.Text = Page.User.Identity.Name End IfI get a Object not found exception. What is the correct way to find a control inside a InsertItemTemplate and the correct Event to use?

remote server problem ; index file cant find my layouts


hi !

i finally managed to finish my first dynamic application with Webmatrix and razor , everything works well locally.

But there are issues online.

i got an index file and a layout file.



in the index file , i've got the following code :

LayoutPage = Href("~/layouts/_layout.cshtml");

when i call the index page with


everything works

but when i try

http://mysite.com/test (without the / at the end )

the server throws this :

Server Error in '/test' Application.

The specified layout page 'test/layouts/_layout.cshtml' could not be found. The following paths have been used: ~/test/layouts/_layout.cshtml;~/Shared/test/layouts/_layout.cshtml;

it seems it cant find the layout file.

any suggestions ?

problem finding textbox in gridview


Hi! I need someone's help please. I have a gridview with a template field column. In the edittemplate of that column i have a textbox. In the next column of the gridview i have a button. When i click the button i need to find the value of the before mentioned textbox. I do it like this: gridview1.selectedrow.findcontrol("textbox1"). This sometimes work just fine and without a problem but sometimes it seems it can't find that control and throws a null reference object. The error it's random like i said, sometimes just work and other just don't work...

Sorry for my english.

Thanks in advance.

ListView with DataPager problem on ASP.NET 4


I'm currently working on upgrading an existing ASP.NET 3.5 app to ASP.NET 4 and I found a rather odd behavior with a ListView and DataPager. I'm using a ListView with an ObjectDataSource and in the ListView I have a DataPager with a NumericPagerField. On my 3.5 web app the page will display the ListView properly and will display the page number links at the bottom, where the DataPager is located. If I go to the last page and delete row by row until all are gone, the ListView will automatically page to the previous page. This is all behavior out-out-the-box since I don't have any special code for paging.

When I run the same app on ASP.NET 4 the behavior changes. The ListView no longer automatically pages to the previous page and I'm left with an empty list, with no way to get back to the previous pages even though there is still data to be retrieved. I get no DataPager control at the bottom because at this point what the ListView is displaying is the EmptyDataTemplate.

The way I've been able to reproduce this is by creating two web apps as follows:

Using Visual Studio 2010 Premium (a release version, not a demo or preview)

Create an empty web application (I called mine WebApplication1) using ASP.NET 3.5 and create a new web form called WebForm1.aspx

Use the following code:

<%@ Page L

Problem with ListView' SelectionChanged event


I have a listview (C#) with some items representing metadata objects. Near this listview I have a Panel where the structure of selected metadata object is shown.

When user selects one item I want to show my Panel (with structure of this item).

When user doesn't select any item or selects many items I want to hide my Panel.

It works but there are a lot of blinks during selection changes. I've prepared workaround to this issue by checking in SelectionChanged event whether the number of selected items changed (none -> one, one -> many, many -> one, one -> none). If the number changed so I show or hide the panel, in other cases I don't do anything.

But one blink is still here. When I just move one-item selection from one item to another then SelectionChanged occures 2 times (for previous selected item and then for next selected item). So my check works incorrectly in this case: one item selection changes to none selection (first SelectionChanged event) and panel becomes hidden, then none selection changes to one item selection (second SelectionChanged event) and panel becomes shown. So user sees blinks.

How can I detect whether user deselected all items at all or just moved the selection from one item to another.

Thanks a lot. Sorry for my English:)

Index Property Notify Problem


A class has index property. For Example:

class A


  private Hashtable ht = new Hashtable();

  public object this[string name]


    get { return ht[name]; }

    set { ht[name] = value; }



The class implements property changed notify. Add codes as below:

class A : INotifyPropertyChanged


  <strong>public event PropertyChangedEventHandler PropertyChanged;

  public void OnPropertyChanged(string name)


     if (PropertyChanged != null)


       PropertyChanged(this, new PropertyChangedEventArgs(name));




[MOSS 2007]Problem on crawl and index


Hi all,


I'm here because I need some help on MOSS 2007 search and I don't find anything to solve my problems.

I have some problems when I try to crawl my sites collections.

On the server (MOSS 2007, Windows Server 2008 64 bits, SQL Server 2008 32 bits), I create many Web App fot my sites collections.

Each Web App has her own content data base.

ListView - Insert Problem



I have a ListView where I am trying to do an insert.

I put the property "oniteminserting" in the ListView, and created the method in the codebehind of the page.

When I try to insert a record, is not calling the method "ListView1_ItemInserting. I put a breakpoint in the method, but is not calling it.

To call the input method in ListView, I'm doing the following:

oniteminserting = "ListView1_ItemInserting"

And the method:

protected void ListView1_ItemInserting (object sender, ListViewInsertEventArgs e)

I tried to delete the method call in the listview, I went into design mode, I clicked in the ListView, I went into properties, events, I gave a double-click the event ItemInserting to recreate the method. But even so, the problem continues.

Does anyone know what might be happening?

* Sorry for bad English. =)

problem with using z-index


Hi,I want to have a background behind a container(div) . I set ther z-indexes but i cant centralize them. what i need is some thing like AOL. but what i make deviates with a wider display or does not stays in one side of body.i did like this:


inside body:



thanks so much

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