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

Top 5 Contributors of the Month
Gaurav Pal


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:)

user control event problem


so i created a user control and i contains an image button the problem is that whenevr i click the image button nothing happens what so ever. I have done every thing according to the book the only diffrence is that i load the usercontrol dynamicly here is sample of my code

public event EventHandler ImageClicked;

protected void image_Click(object sender, ImageClickEventArgs e)
        if (ImageClicked != null)
            ImageClicked(this, e);


in the webform class

autoshowcontrol show = (autoshowcontrol)Page.LoadControl("autoshowcontrol.ascx");
                    show.ImageClicked += new EventHandler(show_ImageClicked);


public void show_ImageClicked(object sender, EventArgs e)

Attached Event Registering Problem in XAML vs. CS



I spent hours searching for a solution to this, but did not find a proper one.

As stated in this post here, there seems to be a difference in how attached events are registered in XAML and in C#.

As described in the MSDN documentation , WPF requires you to implement two methods (AddXYZHandler, RemoveXYZHandler) in order to use an attached Event (XYZEvent) in XAML:


public static readonly RoutedEvent XYZEvent = EventManager.RegisterRoutedEvent("XYZ", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(XYZClass));

public static void AddXYZHandler(DependencyObject d, RoutedEventHandler handler)
 //event registration comes here

public static void RemoveXY

Problem with calling asp button click event from Java script


Dear all ,


I m using these following lines of codes in my java script funtion Save()




var btnSave = document.getElementById('<%=btnSave.ClientID%>');


In ascx,

<asp:Button runat="server" style="display:

listView - ItemDataBound event - problem casting to DataRowView to get to underlying data?


System.InvalidCastException was unhandled by user code
  Message="Unable to cast object of type 'WebSTAR.JobListItem' to type 'System.Data.DataRowView'."
       at WebSTAR.Default.ListViewRecentJobs_ItemDataBound(Object sender, ListViewItemEventArgs e) in C:\Users\djc\Documents\Visual Studio 2008\Projects\WebSTAR\WebSTAR\Default.aspx.cs:line 255
       at System.Web.UI.WebControls.ListView.OnItemDataBound(ListViewItemEventArgs e)

Event id 55555 on Moss servers. Users getting problem to authenticate.


I am frequenty getting this Event id 55555 on Moss servers. Users getting problem to authenticate. Please help how to fix this event on my sharepoint farm.

Error description: Error occured while retrieving customer details from Webservice. Thread was being aborted.

problem in reading event logs of remote machine



I work on application which connects to remote machine and retrieves all event logs from it using EventLogReader and EventLogQuery classes.

I use the API EventLogReader.ReadEvent() for it. It works fine on all platforms except on Windows 7 machine. If I run my application on Windows 7 machine, EventLogReader.ReadEvent() throws an EventLogException with the error message - "The array bounds are invalid"

Have anyone faced this issue before? How I can overcome this problem and continue reading next event logs?

Please let me know.




SharePoint 2007 workflow problem Application Event Viewer shows Event 1314

I created a state machine workflow that works well in a test environment with only one user. When attempting to run the workflow in the production environment, the user sees the message operation in progress. The workflow will not continue. The event log on the server shows Event ID 1314, Event Code 4011. It looks like this has something to do with permissions on the server but I'm not sure where to go from here. I've Googled this and not been able to find a resolution. Any help would be appreciated.

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Regrading Sharpoint 2010 problem and solutions

We can write your question and problem on this blogger.you get ans.use.
Post New Web Links

ListAdded event problem

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :SharePoint


I'm trying to create an event receiver that enables content type management in a document library during library creation. The event receiver works fine when I'm creating a new document library, but it fails when I try to provision a new site containing a document library.

It fails when accessing the List property of the properties parameter, with the following error message :

List '$Resources:cmscore,ListNameDocuments;' does not exist at site with URL 'http://intranet-d.xxxxxxxx.net/w9'

My event handler looks like this:

public class

View Complete Post

More Related Resource Links

Pre_Init event handler problem


Hi all my friends

   I have to masterpages for my home page.

1. The first is for the annonymous users which has the login controls. its name is General_Anonymous.master.

2. The second one is for the logged in users which has a logout button and it hasn't the login controls in it. its name is General_LoggedIn.master.

in my default.aspx page I wrote the following code

protected void Page_PreInit(object sender, EventArgs e)
            if (Session["SupId"] == null && Session["CustomerId"] == null)
                this.MasterPageFile = "~/Masters/General_Anonymous.master";
                this.MasterPageFile = "~/Masters/General_LoggedIn.master";

Visual Studio designer event problem


Hi there

I have a small issue that I'm sure others have experienced - but haven't yet found a solution / workaround for this.

When adding controls to Visual Studio in designer you normally get a event button (the yellow flash light) in the properties window.

But when you nest a button inside a placeholder (for example) you cannot mark the button from the designer - only the placeholder! When trying to go into "split-view" on the designer you'll be able to mark the button in the bottom of the designer - but only properties and not the event button appers in the properties window!

I know that you can go into codebehind and manually add the event but I thiink it is really tiresome to do so if I don't have to...

I had a small hope that VS2010 the issue would be gone but sadly it isn't...

Anyone ever found a solution for this one?

Kind regards Thomas

Sharepoint 2010 List Added Event Problem

Hi All, I have created List Added Event Handler. In that Event I want to Add Custom Field in List as List is created. I get an Error "The Specified Program Requires    a newer version of windows" Is there ant solution for it. I have tried it also creating new instances of spweb and spsite rather than getting it from "Properties" Thanks Saumil Thakkar

C# Problem with multiple SerialDataRecieved event handlers

Hi all, I'm relatively new to C# and have no formal programming experience so apologies in advance if the way I do things are bad practice etc - I generally implement things in a way which seems logical to me! As a small project I'm making a toy car which can drive itself, the problem I've currently got is reading data from two serial port devices at once. The way I tend to work is to write smaller applications to do one function and get that working before integrating it into a larger application which will pull all the functions together. I've written a "Serial_Port_Communications" class which allows you to pass a serial port object into it and then perform some typical functions: open a port, close it, read data, write data etc. Thats common code across all of my serial devices (they all need to do the same operation so why re-write it?) Then for each device I've got a class which handles the operations and data specific to it: GPS & Compass. Each of those two create instances of the Serial_Port_Communications class. In the GPS & Compass classes, they each have a SerialPort object which has an eventhandler assigned to it for when data is received e.g GPS.datareceived += & Compass.datareceived +=... They each work flawlessly when they run as the mini-applications i.e. I can Parse the GPS data that is received and I can read

Weird Paint Event Problem

I am creating a .net program which requires a rectangle to be drawn on the screen,  the code is triggered by a menu item click, which runs the code:    this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::PaintForm);   this event draws a rectangle fill, then a rectangle line around it (anybody know how to make that one shape instead of two?) like this: Graphics^ g = this->CreateGraphics(); Pen^ blackPen = gcnew Pen(Color::Black); SolidBrush^ whiteBrush = gcnew SolidBrush(Color::White); Rectangle stage = Rectangle(70, 70, 339, 439); g->DrawRectangle(blackPen, 69, 69, 340, 440); g->FillRectangle(whiteBrush, stage) the code runs fine, but the shape will not appear (the screen won't blit) until I minimize the form, then restore it. I've tried all sorts of things like using e->Graphics-> Instead of the Graphics^ g = this->CreateGraphics();, and nothing seems to fix it. Any help? By the way, I'm fine with receiving code samples in codes other than c++.

Grid view event problem


i call a sql



mydate <30   grid 1 color is red

mydate <45  grid 1 color is blue

mydate <450   grid 1 color is blue

it is apply on grid coloum how do it

event.keyCode problem in Firefox and chrome


Following code is working in IE but not in Firefox and chorme

TextBox1.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('"+Button1.UniqueID+"').click();return false;}} else {return true}; "); 

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