Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
WebGroupBox and WebImageButton, Hitting Enter on TextBox does not submit form
posted

On a website I am working on, we have a WebGroupBox and two WebImageButtons, Search and Reset.  For some reason, when you enter in text in a text box and hit enter to do the search, it doesn't hit the search method, it now appears to be just refreshing the page and keeping the text you entered in the text box.  Is this functionality different than a regular form/panel?  I tried to wrap the text boxes in a panel but default button doesn't seem to work with WebImageButtons.  

Parents
No Data
Reply
  • 24497
    posted

    Hi Justin,

    I tried to test WebGroupBox which had TextBox, 2 WebImageButtons, and few other buttons located before and after WebGroupBox. If Form.DefaultButton was not set, then the Enter key triggered postback for the very first/top asp:Button or WebImageButton located on page. If Form.DefaultButton was set, then Enter key triggered postback for asp:Button or WebImageButton defined by value of DefaultButton. If that what you expected, then I am not sure why it did not work for you.
    Note: if you use very old version of Infragistics.WebUI, then it is possible that DefaultButton will not work for WebImageButton, because it did not implemented IButtonControl interface. In this case you should upgrade NetAdvantage for more recent version.
    Also WebGroupBox groups children only visually, but not by functionality.
    Below are codes which I tested.

    aspx:
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
    <igmisc:WebGroupBox ID="WebGroupBox1" runat="server" Text="Webgrb" TitleAlignment="Left">
     
    <Template>
       
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
       
    <igtxt:WebImageButton ID="WebImageButton1" runat="server" Text="Search" onclick="WebImageButton1_Click">
       
    </igtxt:WebImageButton>
       
    <igtxt:WebImageButton ID="WebImageButton2" runat="server" Text="Reset" onclick="WebImageButton2_Click">
       
    </igtxt:WebImageButton>
     
    </Template>
    </igmisc:WebGroupBox>

    aspx.cs:
    protected void Page_Load(object sender, EventArgs e)
    {
      this.Button1.Text += "0";
     
    this.Form.DefaultButton = this.WebImageButton1.UniqueID;
    }

    protected void WebImageButton1_Click(object sender, Infragistics.WebUI.WebDataInput.ButtonEventArgs e)
    {
      this.Button1.Text += "1";
    }
    protected void WebImageButton2_Click(object sender, Infragistics.WebUI.WebDataInput.ButtonEventArgs e)
    {
      this.Button1.Text += "2";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
      this.Button1.Text += "3";
    }

    If those codes are wrong, then please attach a simple aspx (within OPTIONS tab) which can be used to test that scenario.

Children
No Data