Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Adding default button to a form.Adding default button to a form.
Previous
 
Next
New Post
12/16/2008 7:09 AM
 

Hi all,

I have a search module but i'm having problems submitting the textbox contents using the enter key.  I created a form and used its attributes to set the default button.  This generates an error:

A critical error has occurred.
A page can have only one server-side form tag.

I'm not so much asking how to solve this error but how do i make the enter key submit the search?

Si

 
New Post
12/17/2008 4:17 AM
 

Surely someone knows why I'm getting that error?

 
New Post
12/17/2008 9:24 AM
 

You are receiving the error because you are permitted to create only one <form . . .> element with runat="server" on an ASP.Net page. Since the DNN Default.aspx page already includes a form element, you cannot create another one.

Instead, I would suggest wrapping the textbox control and button in an ASP.Net panel control and setting the panel's DefaultButton attribute to the ID of the button. Havn't tried it in DNN but it sould work. Something like:

<asp:Panel ID="pnl1" runat="server" defaultbutton="Button1">
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" />
</asp:Panel>


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
12/22/2008 11:15 AM
 

Thanks for replying,

I tried what you suggested with the following code, but it does nothing:

    <asp:Panel ID="pnl1" runat="server" DefaultButton="Linkbutton1" >
        <table class="SearchBar" border="0" cellpadding="0" cellspacing="0">
            <tr>     
                <td>
                    <asp:TextBox cssclass="SearchBarText" ID="txtBox" runat="server" width="150px"></asp:TextBox>
                </td>    
                <td>                 
                    &nbsp;<asp:linkbutton cssclass="SearchBarButton" ID="Linkbutton1" runat="server"
                        onClick="cmdSearch_Click">
                        Search
                    </asp:linkbutton>
                </td>
            </tr>
        </table>
    </asp:Panel>

As you can see I used a Linkbutton instead of a regular Button.  When i type in the text box then press enter nothing happens.

Simon

 
New Post
12/22/2008 11:42 AM
 

Have you tested this in Internet Explorer as opposied to FireFox? See the following for more information about that issue:

http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Adding default button to a form.Adding default button to a form.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out