.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

Preventing Manual DataBindings from Being Stupid...

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :Windows Application
Okay, This is rather annoying, but the basic situation is that using the Control.DataBindings() collection is often VERY simple easy and effective.  However, there are circumstances that require tweaking. Case and point: Application Settings via the My.Settings class structure.  Now, I have a "Preferences" form which upon the load of my application the first time, it requires the user set certain settings (and will cancel out of the app if the aren't defined on the first load).  All of this works fine, but I have a minor little glitch revolving around the Binding.Parse event and the Binding.WriteValue() method. Basically, when the Preferences form loads, all the controls that are bound to a My.Settings property, are set to DataSourceUpdateMode.Never.  In the Form.Load event, I execute a Control.DataBindings(0).ReadValue() on each of the controls that are bound.  This propagates the form with the appropriate values from the My.Settings Class.  Now the user changes/edits/modifies etcetera the values of the controls on the form, and based upon the appropriate values the OK Button will become enabled. Two of the values are "Folder Locations" but are uniquely formatted in my case, using a "special folder" moniker, for Desktop, or My Documents, etc, etc, etc, so if the user browses for a folder or types one in manually, m

View Complete Post

More Related Resource Links

Stupid ActiveX problem on a Webserver


 I have developed an asp.net website that uses an old activex.exe control.

The website works fine when someone is logged in on the server, but gives the following error when no one is logged in on the server :

Unable to cast COM object of type 'Proxyticketserver.TicketingClass' to interface type 'Proxyticketserver._Ticketing'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{848607B6-A467-4F40-9450-E543EDDE7080}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Anyone any idea?





Converting Crystal Report 2005 to 2008 - Please Tell Me I'm Stupid :)


Hello peeps,

  I have a series of Crystal Reports that I can view/edit using Visual Studio 2005 with no issues.  The method I'm using is to simply click on the *.rpt file and it opens in the VS crystal editor with no issues.  The problem I'm having is that we are upgrading to Visual Studio 2008, and when I open the *.rpt file in 2008 it opens as a binary file.  I guess I'm used to everything else in Visual Studio prompting me to convert the older version to the newer version, so I'm not sure what to do in this case.

  Is this normal?  Is there an easy conversion method that I'm simply overlooking?  Am I screwed?  Who invented liquid soap, and why?

Answers to any of these questions would be greatly appreciated...

Manual Rendering a Button

Hi, I am new to WPF. I have a custom control being derived from Button. I have overridden OnRender method to make it look Trapezoidal. When I add this custom button on my window/grid, I see the main button also being rendered along with the custom shape I had defined in OnRender. I am not able to understand where the default shape is being rendered from? Any help would be greatly appreciated..          

.Net Framework 4.0 preventing v2.0 aspnet_regiis from Running

Hi Folks, We have a ASP.net 2.0 web app with an installer which appears to hit an issue with .Net Framework 4.0. This has occurred on XP and Windows 7. Seems to happen every time. During the installation, we call aspnet_regiis for various tasks such as encrypting the web.config. If .Net 4 is installed this throws the error: --------------------------- aspnet_regiis.exe - .NET Framework Initialization Error --------------------------- Unable to find a version of the runtime to run this application. --------------------------- OK    --------------------------- Running the same commands from the commandline works correctly.  Anyone have any idea what is going on? Thanks, Davy

Preventing users from changing password

How to i keep users from changing password for a mssql account? We have a shared login which is readonly to the database.  But every now and then, someone decides to change the password.

Stupid web.config mistake: Sections must only appear once per config file

Today's stupid mistake comes to you via the web.config file in an ASP.NET 4 Web application project. At runtime, when navigating to default.aspx, ASP.NET choked with this error message: Parser Error Message: Sections must only appear once per config file.  See the help topic <location> for exceptions. Source Error: Line 14:     <location path="default.aspx"> Line 15:         <system.web> Line 16:            ...(read more)

User Manual for Sharepoint Foundation 2010

Is there an user manual for Sharepoint Foundation 2010?  We downloaded this product in order to create an intranet for our firm, but the software is NOT intuitive and does not provide clear click-by-click instructions on how to do this.  We need an instruction manual asap, that includes a sub-section on how to easily design and create an intranet.  Thank you. 

Hi, everyone I am new to ASP.net. What is your opinion on manual coding?

I am new to ASP.net. I am using Visual Web Developer 2008 Express. In the past, I had gotten used to writing html code using nothing more than notepad. This kept things nice and neat. Since trying out VWD, I have realized how important the IDE really is so I am very happy to use it. At the same time, sometimes I am drawn back to wanting to do things manually.   I would like to know if there is anyone out there that has been writing ASP.net code without the IDE and if there is a benefit to this in any way. Is everything best left to the IDE?

why would a dba do a manual failover on a cluster

Why would a dba do manual failover because of high cpu?  I got no answer from dba, but cpu did improve from 85 to 60, then down to about 40%.  My thought is there was parameter sniffing problem and clear proc cache from failover fixed the problem, recompiling all the procs is why cpu high at first after failover?  Until cpp started spiking to 80 it was under 50% all day.

Stupid developer tricks - When a data type overflow doesn't cause an overflow

Build a very basic cube that has a dimension with a hierarchy and a single measure.  For example, a time dimension with Year, Quarter, Month, Date along with a quantity sold.  The quantity sold is an integer in your database. Now, load up your database with test data such that the quantity when rolled up to a quarter level will be just less than the maximum value for an integer.  Process your cube and see the absolutely stupid value that gets displayed for a year. For those of you reading along and not wanting to build a cube to see what happens, here it is in a nutshell. To make the math simple, we'll use 2 billion as the max value for an int and -2 billion and the min value.  Say for example that the quantity sold for each quarter was 1 billion units.  When you look at the cube from the quarter on down, you see nice, neat POSITIVE values.  But, when you look at the quantity sold for the year, SSAS reports the quantity sold as 0. No, it didn't substitute 0 for a data type overflow (4 billion exceeds the 2 billion max).  Instead, the developer of this "feature" decided that it would be a really nice idea to just ignore the fact that you had a data type overflow and just treat the range of values as a looping structure.  So, his code said, take the aggregated value, run it all the way up to the last value in the range and tak

FormView Manual Data Updating

I've posted this some place else but have not heard from anyone and hoping I get better luck here.   Note: Sorry about the formating, not sure what happened.I have a FormView that I user for updating a record. There is a link button that when fires should perforom the updating viaBLL and DAL. I am not using built-in ODS and I will not condsider using it. I have all my grids and formviews populated manuualy by calling methods that fetch the data from the database. For instance my details view is populated like this:  protected void DlMembers_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName.ToString() == "Select") { DlMembers.Visible = false; lblError.Text = string.Empty; lblError.Visible = false; fvMemberDetail.Visible = true; fvMemberDetail.ChangeMode(FormViewMode.Edit); MemberBLL getMemberInfo = new MemberBLL(); int Ident = Convert.ToInt32(e.CommandArgument.ToString()); fvMemberDetail.DataSource = getMemberInfo.GetMemberByIdent(Ident); fvMemberDetail.DataBind(); } if (e.CommandName.ToString() == "DeleteSelected") { DlMembers.Visible = true; lblError.Text = string.Empty; lblError.Visible = false; fvMemberDetail.Visible = false; fvMemberDetail.ChangeMode

Preventing selectedindex changed from firing on binding

When I bind a combo box to an object and it is initially displayed, I notice that the selectedindex changed event is being fired. I don't want this event to fire unless the control is changed interactively. Is there a way to prevent this from occurring or should I be using a different event? TIA

Preventing the "This program might not have installed correctly" warning when (not) installing .NET

Hi all,I am trying to create an installer using Installshield 2009 Pro, which needs to include .NET Framework 3.5 SP1 (the full version or the web downloader, depending on the deployment method). I am using the built-in prerequisites and everything works fine on XP and Vista.However, on Windows7 the installation causes the "This program might not have installed correctly" warning to appear in installer versions that include the .NET Framework prerequisite; I need to prevent this.I understand that Windows7 already includes .NET Framework 3.5 SP1 (and that the .NET setup does not support Windows7), however I cannot find a way to prevent the prerequisite from attempting to install on that OS (the built-in checks seem not to prevent it, either). Either that, or the failure to install is what actually prompts the error message in the first place.So can anybody offer any guidance on how to prevent this warning on Windows7? So far the only choice I can think of is to have a separate installer for Windows7 that does not include the .NET prerequisite, however because it is a requirement for the CD version to include the full .NET installer rather than just the downloader, space is already at a premium.Thanks in advance.

Unable to change textbox values after manual assignment



In my webapp, I have a DropDownList_OnSelectedIndexChanged that assigns values for a number of <asp:textbox'es depending on which entry is selected...

       public void ModifyProjectIDBox_SelectedIndexChanged(object sender, EventArgs e)


            int tempJobID = Get_Selected_Report();

            dbCommandString = "SELECT Name, Address, State, Awarded, StartDate, EndDate, HomeLocal FROM dbo.ProjectInfo WHERE ProjID = " + tempJobID;

            dbComm.CommandText = dbCommandString;


            dbReader = dbComm.ExecuteReader();


                ModifyProjectNameBox.Text = dbReader[0].ToString();


            ModifyProjectAddrBox.Text = dbReader[1].ToString();

            ModifyProjectStateBox.Text = dbReader[2].ToString();


tutorials(manual or video)


where we can get tutorial videos or manuals in starting web forms in asp.net

Preventing cross-site scripting and encoding a single quote


I'm trying to prevent possible cross-site scripting attacks for our internal use app (but available publicly outside the firewall).

One feature of our app is a javascript based breadcrumb that keeps track of prior urls (via nice titles). Everytime, a new page is loaded in the current workflow, when that page renders as the browser, it includes some javascript (generated server side in C# and put into the page) to add itself to the breadcrumb trail. Currently, the url that is launched is given directly to that javascript function. However, if that url contains a single quote it is possible to inject some custom javascript, ie, one would just need to append    ');alert('yeah!');       to their url.

I tried encoding/escaping but they skip the single quote. This is a case where I'm just passing the url through. But theoretically, if an attacker tricked somebody into launching his site when they are in ours, then I guess he could get script to execute in our page.

I don't see any method that takes a COMPLETE url and encodes/escapes JUST the parameters. So for now, I'm tearing down the url, and rebuilding it from the ground up, but encoding the parameter names and values.  This basically prevents the script from running, but I do still end up with at least a javascript error because of

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