Checkbox onclick() problem in datagrid

Results 1 to 2 of 2

Thread: Checkbox onclick() problem in datagrid

  1. #1
    Join Date
    Dec 1969

    Default Checkbox onclick() problem in datagrid

    I would like to call a javascript function like checkthis(this) and passing the current checkbox object to the function from adatagrid. I use a template column for this checkbox and put &#060;asp:CheckBox Runat=server id="ckname" onclick(this);/&#062;<BR><BR>but it won&#039;t understand "this" which is checkbox object inside the called function.<BR><BR>but if i use<BR>&#060;input type="checkbox" runat="server" id="ckname" onclick(this);&#062;<BR>it works fine.<BR><BR>But i cannot dinamically disable or enable this html checkbox, as it returns an error while i try to write "Enabled" /"Disabled" as checkbox attribute.<BR><BR>In asp:checkbox, <BR>enbaled=&#039;&#060;%# GetCheckBoxValue(Convert.ToInt32(DataBinder.Eval(C ontainer.DataItem, "CheckBoxValue"))) %&#062;&#039; will work for me.<BR><BR>I guess the same problem might have happend to others.<BR>If anybody got a solution for this, i would appriciate their help.

  2. #2
    Join Date
    Dec 1969

    Default RE: Checkbox onclick() problem in datagrid

    I&#039;ve had better luck adding this kind of thing in the Page_Load as an attribute of the checkbox.<BR><BR>ckname.Attributes.add("onClick", "checkthis(this)")<BR><BR>As for disabling a form element its something like this from javascript:<BR><BR>document.forms(0).ckname.disabl ed = true;<BR><BR>If you write it in html I think its Disabled = "disabled" or disabled = "false". But from server side its enabled = true/false.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts