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
222
Enable or disable a checkbox based on data value
posted

I am trying to enable and disable the checkbox depending on the dataset. If the value is true or 1 then

i want the checkbox disable other wise it should be enable.

Is there any idea ? Please help me out.

Thanks in advance.

Saro

 

  • 2907
    posted

    Could you please provide some more information?

    (1)     Do you have checkbox inside template column or you are getting checkbox because of column with boolean data type?

    (2)     When you want to make enable/disable? On change of some of the cell value? Or at the initial load time?

    • 222
      posted in reply to H B

      Hi HBA,
      Thanks for the response.

      (1)     Do you have checkbox inside template column or you are getting checkbox because of column with boolean data type?

      I have created checkbox as follow (Bands)
      <Bands>
      <igtbl:UltraGridBand><Columns>
      <igtbl:UltraGridColumn Key="TenderStatus" Type="CheckBox">
      <Header>
      <RowLayoutColumnInfo OriginX="1"></RowLayoutColumnInfo>
      </Header>
      <Footer>
      <RowLayoutColumnInfo OriginX="1"></RowLayoutColumnInfo>
      </Footer>
      </igtbl:UltraGridColumn>
      </Columns>
      <AddNewRow Visible="NotSet" View="NotSet"></AddNewRow>
      </igtbl:UltraGridBand>
      </Bands>

      (2)     When you want to make enable/disable? On change of some of the cell value? Or at the initial load time?
      At load time (Form load) using Dataset.

      Thank you very much again.

      Saravanan

      • 2907
        posted in reply to saravanan

        I think if you need to use template column for your requirement.

         

        After converting your CheckBox column to templete column you can handle InitializeRow evnet in following way.

         

        protected void UltraWebGrid1_InitializeRow(object sender, RowEventArgs e)

        {

        //Get reference of checkbox from template column

        TemplatedColumn col = (TemplatedColumn)row.Cells..FromKey("TenderStatus").Column;

        CellItem ci = (CellItem)col.CellItems[e.Row.Index];

        CheckBox chk1 = (CheckBox) ci.FindControl("Id_Of_CheckBox_In_TemplateColumn");

         

        //Get the enabled/disable value

        bool enabled = SomeFunctionToGetEnabledForCurrentRow();

         

        chk1.Enabled = enabled;

         

        }

        For further detail refer:

        (1) http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=3471

        (2) http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=4876