Posts Tagged ‘asp.net’
GridView with DropDownList – Server tag is not well formed.
Ran across an issue today when trying to get my DropDownList embedded within a GridView. Here is an extract of the code (the error is in the red text):
<ItemTemplate>
<asp:DropDownList
ID="ddlMaker"
runat="server"
DataSourceID="odsMakers"
DataTextField="makerName"
SelectedValue="<%#Bind("MakerID") %>"
DataValueField="makerID">
</asp:DropDownList>
</ItemTemplate>
When I compiled I received an error “The server tag is not well formed.”
After a bit of trial and error I realized it was because there were quotes nested within quotes. To make this work all that had to be done was to change the outside double quotes on the SelectedValue parameter to be single quotes as shown below.
<ItemTemplate>
<asp:DropDownList
ID="ddlMaker"
runat="server"
DataSourceID="odsMakers"
DataTextField="makerName"
SelectedValue='<%#Bind("MakerID") %>'
DataValueField="makerID">
</asp:DropDownList>
</ItemTemplate>
Hope I saved someone a bunch of wasted time.
ASP.NET AJAX Control Toolkit Samples
Most of you probably have already experimented with the Control Toolkit, but just in case you never ran across it, take a look at these Toolkit samples
If you have any questions about them, drop me a comment here.
Disabling buttons on click for ASP.NET forms
Found some great tips in the simple-talk.com blog about disabling buttons on asp.net forms.
If you ever created a form and had your users click on the submit button multiple times this is the code you have been looking for. Be sure to check out Robyn Page’s comments for a method to block the whole form during the form submit as well.
Complete details can be found here.