Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: OnCheckedChanged in Datagrid Doesn't Work


Message #1 by "Lou Feicht" <lfeicht@f...> on Tue, 4 Dec 2001 00:44:28
Nevermind, i found the problem. thanks.

> I have a datagrid with one of the bound columns being a check box.
> 
> I want the checkbox to autopostback so I can catch the event and update 
> the database.
> 
> <asp:DataGrid id="dg"
> runat="server"
> font-size="8"
> OnEditCommand="dg_Edit"
> OnCancelCommand="dg_Cancel"
> OnUpdateCommand="dg_Update"
> OnItemCreated="dg_ItemCreated"
> AutoGenerateColumns="False"
> OnSortCommand="SortRows"
> AllowSorting="True"    
> ShowHeader = "True"
> EditItemStyle-BackColor="yellow"
> DataKeyField="OID"
> CssClass="TableBody">
> 
> ................
> 
> <ASP:TemplateColumn HeaderText="ON/OFF">
> 		 <ItemTemplate>
> 			<ASP:CheckBox 
> 				id="chkStatusNonEdit"
> 				AutoPostBack=True
> 				OnCheckChanged="UpdateStatus"
> 				Checked='<%# CIntToBool(DataBinder.Eval
> (Container.DataItem,"STATUS").ToString()) %>' runat="server" />
> 		</ItemTemplate>
> 
> ..........................................
> 
> void UpdateStatus(Object sender, EventArgs e) {
> 	Response.Write("This Changed.");
> 
> }
> 
> The page is doing autopostback when the checkbox is changed, but the 
> UpdateStatus function is not being 'activated'. 
> 
> 
> 

  Return to Index