Posts

Showing posts with the label ASP.NET 2.0

ASP.NET 2.0 DropDownList EnableViewState

In ASP.NET 2.0 the  DropDownList   EnableViewState  doesn't work the same as other controls like GridView . Fortunately Anson Goldade created one that does. You can learn how here:  http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.aspnet.webcontrols/2006-02/msg00149.html

ASP.NET 2.0 Wizard Control - Cancelling the next/previous button

If your using the ASP.NET 2.0 Wizard control and you want to stop the next button from going to the next step you have to set the event arg property Cancel to true like so: Private Sub Wizard1_NextButtonClick( ByVal sender As Object , ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick e.Cancel = True End Sub

ASP.NET 2.0 Stack Overflow error in Wizard control

Was using the MaintainScrollPositionOnPostback=true in a page directive with the ASP.Net 2.0 Wizard control and started getting a stack overflow error when clicking on a Sidebar button.  Could not find a decent fix so I opted for a workaround and removed the MaintainScrollPositionOnPostback attribute and implemented this: http://aspnet.4guysfromrolla.com/articles/111704-1.2.aspx

ASP.NET 2.0 RegularExpessionValidator to exclude a specific line.

Say you had the following select: < select id ="ItemSelect" runat ="server">   < option selected ="selected"> Select your item </ option >   < option > Item one </ option >   < option > Item two </ option >  < option > Item three </ option > </ select > And you wanted to force the user to select Item one/two/three. You could do this by creating a RegularExpressionValidator to to accept anything but the “Select your item” option like so: < asp : RegularExpressionValidator ID ="ItemRegularExpressionValidator" runat ="server" ControlToValidate ="ItemSelect" ErrorMessage ="Item Required" Text ="*" SetFocusOnError ="true" ValidationExpression ="^((?!Select your item).)*$"></ asp : RegularExpressionValidator >

Handling the SelectedIndexedChanged event of a DropDownList in a GridView in ASP.NET 2.0

Say you had a GridView with a dropdownlist like this: < asp : GridView ID ="testGridView" runat ="server">     < Columns >         < asp : BoundField DataField ="TestField" />         < asp : TemplateField >             < ItemTemplate >                 < asp : DropDownList ID ="TestDropDownList" runat ="server" AutoPostBack ="true">                     < asp : ListItem Value ="1"> Item 1 </ asp : ListItem >                     < asp : ListItem Value ="2"> Item 2 </ asp : ListItem >                 </ asp : DropDownList >             </ ItemTemplate >         </ asp : TemplateF...

ASP.NET 2.0 DataList - properties set in ItemDataBound event not persisted during postback

If you have a DataList control and capture the ItemDataBound event like this: Private Sub DataList1_ItemDataBound( ByVal sender As Object , ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemDataBound And then suddenly have the urge to do something to e.item and expect it to exist after a postback you best be a suppressing that urge because nothing you do to e.item in the ItemDataBound event of a DataList control will survive a postback. The reason used to be described here: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=104649&wa=wsignin1.0