[CLOSED] Trouble setting checkbox from code behind to checked

  1. #1

    [CLOSED] Trouble setting checkbox from code behind to checked

    Hi

    It looks so simple that I am sure that I overlooked something important but I can't find it and it is bugging me for days without having found a solution on the web.

    I just want to get that checkbox checked through code behind.

    aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="demo.aspx.cs" Inherits="demo" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="Form" runat="server">
    
            <ext:ResourceManager ID="ResourceManager" runat="server" />
    
            <ext:Button runat ="server" OnClientClick="App.direct.onButtonClick()" Text="Open window" />
        </form>
    </body>
    </html>
    cs:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net;
    
    public partial class demo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
               
            }
        }
    
        // On button click open window with checked checkbox
        [DirectMethod]
        public void onButtonClick()
        {
            Window win = new Window
            {
                Title = "Demo",
                Items = { new Checkbox { FieldLabel = "checkbox", Checked = true } }
            };
    
            win.Render(this.Form);
        }
    }
    Thank you very much.
    Last edited by Daniil; Sep 06, 2013 at 2:07 PM. Reason: [CLOSED]
  2. #2
    Hi @tMp,

    Yes, that is a known problem.
    https://github.com/extnet/Ext.NET/issues/251

    Please set up this setting for the Checkbox to get rid off the problem.
    IsDynamic = true
  3. #3
    Thank you. Working perfectly like this. Sorry that I didn't find this myself.
  4. #4
    You are good. When I faced this issue first time, I spent quite a lot of time to sort it out. Ideally, it should not require that IsDynamic setting, but we were unable to come up with better solution.

Similar Threads

  1. treepanel how does checked only one checkbox
    By btbtbtbbt in forum 2.x Help
    Replies: 0
    Last Post: Sep 13, 2012, 3:08 AM
  2. Replies: 3
    Last Post: Jun 07, 2012, 6:15 PM
  3. Replies: 2
    Last Post: Mar 22, 2011, 3:40 PM
  4. Replies: 7
    Last Post: Sep 20, 2010, 10:06 PM
  5. Trouble adding portlet from code behind
    By cmschick in forum 1.x Help
    Replies: 0
    Last Post: Feb 16, 2009, 8:21 AM

Posting Permissions