Got a FormView which when you first open is in readonly mode. There is a button to click which puts you in Edit mode where I can make changes and save back to the database, this is all working great.
I have a Checkbox and a textbox, when I untick the checkbox I need it to clear my textbox and it's this bit that is not working. If I tick the box I can get it to do something, just not when I untick and it is doing my head in. Here is the code for the
main page and the code behind. There are other fields but to make it easier just stripped it down to the problem area.
Just put in a dummy line of code the response.write bit, which works when ticking the box, but again not on the untick [:(], once I get it to display both of these then I can handle the textbox no problem.
Hi, I dont think there is anything wrong with your code behind. I think the issue probably is because you have bound your checkbox to a field in your database within the aspx markup and have the AutoPostBack property set to true. Therefore, when you 'uncheck'
the checkbox, the code is correctly executed however, the checkbox posts back, which causes the page to reload, which rebinds the checkbox to the database value again and also clears the response.write text from the page. You can follow this through if you
put a debug 'Break' on the 'If' statement and then step through line by line.
Hi, I thought it may have had something to do with being bound to the database, however it's not the case. I had removed any code binding the field to the database and it made no difference, so I am at a loss. If it works when ticking the box, it should
work, when unticking [:(]
I just tried something, I set the checkbox to be checked=true and when I untick it, the code fired this time, but now it doesn't fire when ticking. It seems the code is only running when I set it back to it orginal setting ?
/****** Object: Table [dbo].[appBase_Stage1] Script Date: 08/28/2008 09:33:11 ******/ SET ANSI_NULLS ON
GO SET QUOTED_IDENTIFIER ON
GO SET ANSI_PADDING ON
GO CREATE TABLE [dbo].[appBase_Stage1](
[dbID] [int] IDENTITY(1,1)
NOT NULL,
[dbAdded] [int] NOT NULL,
[dbTitle] [dbo].[VarC_200] NULL,
[dbApproved] [bit] NOT NULL,
[dbRejected] [bit] NOT NULL,
[dbArchived] [bit] NOT NULL,
[dbInventorLinkID] [int] NULL,
[dbLastAmended] [int] NULL,
[dbGeneratedCode] [varchar](10)
NULL,
[dbRejectReason] [varchar](500)
NULL,
[dbDateArchived] [int] NULL,
[dbAdminUser] [int] NULL,
[dbEnquiry] [bit] NULL,
[dbEnquiryType] [int] NULL,
[dbConvertDate] [int] NULL,
[dbOwner] [int] NULL,
[dbType] [varchar](3) NULLCONSTRAINT [DF_tblAppPartA_pAType]
DEFAULT ('_'),
[dbCompetition] [bit] NULLCONSTRAINT [DF_tblAppPartA_pACompetition]
DEFAULT ((0)),
[dbLegal] [bit] NULL,
[dbPaperFile] [bit] NULL,
[dbTransfer] [bit] NULL,
[dbTransferDate] [int] NULL,
[dbHearAboutUs] [varchar](6) NULL,
[dbHearAboutOther] [dbo].[VarC_100] NULL,
[dbNotes] [varchar](max)
NULL, CONSTRAINT [PK_tblAppPartA] PRIMARY KEY CLUSTERED
(
[dbID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE =
OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS =
ON, ALLOW_PAGE_LOCKS = ON,
FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO SET ANSI_PADDING OFF
GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Previous: tblAppPartA
Used to hold the base information about an Idea' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'appBase_Stage1'
/****** Object: Table [dbo].[appSystemAdminUsers] Script Date: 08/28/2008 09:36:42 ******/ SET ANSI_NULLS ON
GO SET QUOTED_IDENTIFIER ON
GO SET ANSI_PADDING ON
GO CREATE TABLE [dbo].[appSystemAdminUsers](
[adID] [int] IDENTITY(1,1)
NOT NULL,
[adName] [varchar](30) NOT NULL,
[adInitials] [varchar](4) NULL,
[adEmail] [varchar](120) NULL,
[adSuspend] [bit] NOT NULL, CONSTRAINT [PK_tblAppAdminUsers]
PRIMARY KEY CLUSTERED
(
[adID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE =
OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS =
ON, ALLOW_PAGE_LOCKS = ON,
FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO SET ANSI_PADDING OFF
/****** Object: Table [dbo].[appSystemTrusts] Script Date: 08/28/2008 09:37:06 ******/ SET ANSI_NULLS ON
GO SET QUOTED_IDENTIFIER ON
GO SET ANSI_PADDING ON
GO CREATE TABLE [dbo].[appSystemTrusts](
[trustID] [int] IDENTITY(1,1)
NOT NULL,
[trustName] [varchar](250) NOT NULL, CONSTRAINT [PK_tblAppTrusts] PRIMARY KEY CLUSTERED
(
[trustID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE =
OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS =
ON, ALLOW_PAGE_LOCKS = ON,
FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO SET ANSI_PADDING OFF
Stored procedure:
USE [NHSIPv2]
GO
/****** Object: StoredProcedure [dbo].[usp_IdeaUpdates] Script Date: 08/28/2008 09:28:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ================================================
-- Author: Me
-- Create date: 26/08/2008
-- Description: Handles update and inserts on the
-- appBase_Stage1 table
-- ================================================
ALTER PROCEDURE [dbo].[usp_IdeaUpdates]
-- Add the parameters for the stored procedure here
@type int=0, --0 = Select | 1 = Insert | 2 = Update | 3 = Delete
@dbID int=null,
@dbTitle varchar(200)=null,
@dbArchived bit=null,
@dbPaperFile bit=null,
@dbTransfer bit=null,
@dbDateArchived DateTime=null,
@dbTransferDate DateTime=null,
@mess varchar(100)=null OUTPUT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
/*==================================================
SELECT
==================================================*/
IF @type=0
BEGIN
SELECT dbType+CONVERT(varchar(8),dbID) + CASE WHEN dbCompetition=0 THEN 'Y' ELSE 'N' END AS ID,
dbTitle,dbNotes,dbRejectReason,dbo.udfDateFormat(dbAdded,1) AS dbAdded,
dbo.udfDateFormat(dbLastAmended,1) AS dbLastAmended,
dbApproved,dbArchived,dbPaperFile,dbTransfer
,(SELECT adName FROM appSystemAdminUsers WHERE adID=dbAdminUser) AS dbAdminUser
,(SELECT adName FROM appSystemAdminUsers WHERE adID=dbOwner) AS dbOwner
,inName,inTel,inEmail,trustName,dbo.udfDateFormat(dbDateArchived,1) AS dbDateArchived
,dbo.udfDateFormat(dbTransferDate,1) AS dbTransferDate
FROM appBase_Stage1
LEFT OUTER JOIN appInventors ON inID=dbInventorLinkID
LEFT OUTER JOIN appSystemTrusts ON trustID=inTrust
WHERE dbID=@dbID
END
/*==================================================
UPDATE
==================================================*/
IF @type=2
BEGIN
BEGIN TRAN
UPDATE appBase_Stage1 SET
dbTitle=@dbTitle,
dbArchived=@dbArchived,
dbPaperFile=@dbPaperFile,
dbTransfer=@dbTransfer,
dbDateArchived=null,
dbTransferDate=null
WHERE dbID=@dbID
IF @@error<>0
BEGIN
ROLLBACK
SELECT @mess='ERROR: Update failed'
RETURN
END
COMMIT
BEGIN
--SELECT @mess='Updated record ID:'+CAST(@dbID AS varchar(5))
SELECT @mess='Updated record ID:'+CAST(@dbID AS varchar(5))+' | '+CAST(@dbDateArchived AS varchar(20))
END
END
END
Now in javascript, write the below code, there i put some alert statements. when they come click ok, when functionality is achieved, remove those alerts
I have a Checkbox and a textbox, when I untick the checkbox I need it to clear my textbox and it's this bit that is not working. If I tick the box I can get it to do something, just not when I untick and it is doing my head in. Here is the code for the
main page and the code behind. There are other fields but to make it easier just stripped it down to the problem area.
I just tried myself with a sample code. i did it in the following way.
Finally sorted out the problem. In the master page I had the EnableViewState set to False, but in the acutal page I had this set to true, so I would have thought it would override the master page setting. Well apparently it doesn't, once I set the viewstate
to true in the master page it started working.
Could anyone tell me if this is right I thought you could override the master page setting.
Anyway thanks for those that tried to help much appreciated.
Icemania
Member
100 Points
148 Posts
Checkbox not firing when unchecking using OnCheckedChanged
Aug 27, 2008 02:57 PM|LINK
New to this so please bear with me.
Got a FormView which when you first open is in readonly mode. There is a button to click which puts you in Edit mode where I can make changes and save back to the database, this is all working great.
I have a Checkbox and a textbox, when I untick the checkbox I need it to clear my textbox and it's this bit that is not working. If I tick the box I can get it to do something, just not when I untick and it is doing my head in. Here is the code for the main page and the code behind. There are other fields but to make it easier just stripped it down to the problem area.
<asp:FormView ID="fvMain" runat="server" DataSourceID="sdsMain" DefaultMode="ReadOnly"> <EditItemTemplate> <div><label>Archived:</label><asp:CheckBox ID="dbArchived" runat="server" Checked='<%# Bind("dbArchived") %>' OnCheckedChanged="dbArchived_OnCheckedChanged" AutoPostBack="true" /> <asp:TextBox ID="dbDateArchived" runat="server" Columns="12" MaxLength="12" Text='<%# Bind("dbDateArchived") %>'></asp:TextBox></div> </EditItemTemplate> <EmptyDataTemplate> <p>No data found</p> </EmptyDataTemplate> </asp:FormView>smcoxon
Contributor
5455 Points
948 Posts
Re: Checkbox not firing when unchecking using OnCheckedChanged
Aug 27, 2008 06:32 PM|LINK
Hi, I dont think there is anything wrong with your code behind. I think the issue probably is because you have bound your checkbox to a field in your database within the aspx markup and have the AutoPostBack property set to true. Therefore, when you 'uncheck' the checkbox, the code is correctly executed however, the checkbox posts back, which causes the page to reload, which rebinds the checkbox to the database value again and also clears the response.write text from the page. You can follow this through if you put a debug 'Break' on the 'If' statement and then step through line by line.
Smcoxon
No Gem is ever polished without some friction.
Icemania
Member
100 Points
148 Posts
Re: Checkbox not firing when unchecking using OnCheckedChanged
Aug 28, 2008 07:38 AM|LINK
Hi, I thought it may have had something to do with being bound to the database, however it's not the case. I had removed any code binding the field to the database and it made no difference, so I am at a loss. If it works when ticking the box, it should work, when unticking [:(]
I just tried something, I set the checkbox to be checked=true and when I untick it, the code fired this time, but now it doesn't fire when ticking. It seems the code is only running when I set it back to it orginal setting ?
ramireddyind...
All-Star
31358 Points
4579 Posts
Re: Checkbox not firing when unchecking using OnCheckedChanged
Aug 28, 2008 08:07 AM|LINK
when you uncheck the checkbox, is the event firing or not?
by setting a break point, we can find easily whether event is firing or not.
if the event is firing? check into what logic, execution goes, ?
post your code. so that we can understand what is happening?
Icemania
Member
100 Points
148 Posts
Re: Checkbox not firing when unchecking using OnCheckedChanged
Aug 28, 2008 08:15 AM|LINK
Just tried that and no the code is not firing at all when unchecking. Right here is all the code for the page and code behind.
<%@ Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="ideaDetails.aspx.cs" Inherits="admin_ideas_ideaDetails" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="cphContent" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <div id="conContent"> <div class="block"> <h2>Ideas details <asp:Literal ID="litMode" runat="server"></asp:Literal></h2> <fieldset id="subNav"><a href="Default.aspx?uid=<%=uid %>">Return to list</a></fieldset> <asp:Panel ID="pnlStatus" runat="server"><asp:Literal ID="litStatus" runat="server"></asp:Literal> <asp:ValidationSummary ID="vsMain" runat="server" DisplayMode="BulletList" ShowSummary="true" EnableViewState="False" CssClass="st_error" /> </asp:Panel> <asp:SqlDataSource ID="sdsMain" runat="server" ConnectionString="<%$ ConnectionStrings:NHSIPv2 %>" SelectCommand="usp_IdeaUpdates" SelectCommandType="StoredProcedure" UpdateCommand="usp_IdeaUpdates" UpdateCommandType="StoredProcedure" OnUpdated="sdsMain_Updated"> <SelectParameters> <asp:Parameter DefaultValue="0" Name="type" Type="Int32" /> <asp:QueryStringParameter DefaultValue="" Name="dbID" QueryStringField="tag" Type="Int32" /> </SelectParameters> <UpdateParameters> <asp:Parameter DefaultValue="2" Name="type" Type="Int32" /> <asp:QueryStringParameter Name="dbID" QueryStringField="tag" Type="int32" /> <asp:FormParameter FormField="dbTitle" Name="dbTitle" Type="string" /> <asp:FormParameter FormField="dbArchived" Name="dbArchived" Type="Boolean" DefaultValue="False" /> <asp:FormParameter FormField="dbPaperFile" Name="dbPaperFile" Type="Boolean" DefaultValue="False" /> <asp:FormParameter FormField="dbTransfer" Name="dbTransfer" Type="Boolean" DefaultValue="False" /> <asp:Parameter Direction="Output" Name="mess" Type="string" Size="100" /> </UpdateParameters> </asp:SqlDataSource> <asp:FormView ID="fvMain" runat="server" DataSourceID="sdsMain" DefaultMode="ReadOnly" > <ItemTemplate> <fieldset><legend>Entry ID</legend> <div><label>ID Number:</label><%# Eval("ID") %></div> <div><label>Added:</label><%# Eval("dbAdded") %></div> <div><label>Last amended:</label><%# Eval("dbLastAmended") %></div> </fieldset> <fieldset><legend>Inventor details</legend> <div><label>Inventor:</label><%# Eval("inName") %></div> <div><label>Telephone:</label><%# Eval("inTel") %></div> <div><label>Email:</label><asp:HyperLink ID="hlEmail" runat="server" NavigateUrl='<%# Eval("inEmail")==DBNull.Value ? "" : Eval("inEmail","mailto:{0}") %>' Text='<%# Eval("inEmail")==DBNull.Value ? "" : Eval("inEmail") %>'></asp:HyperLink></div> </fieldset> <fieldset><legend>Entry details</legend> <div><label>Title:</label><%# Eval("dbTitle") %></div> <div><label>Approved:</label><%# Convert.ToBoolean(Eval("dbApproved"))==true ? "Approved" : "No" %></div> <div><label>Archived:</label><%# Convert.ToBoolean(Eval("dbArchived"))==true ? "Yes" : "No" %> <%# Eval("dbDateArchived")!=DBNull.Value ? "("+Eval("dbDateArchived")+")" : "" %> </div> <div><label>Paper file:</label><%# Convert.ToBoolean(Eval("dbPaperFile"))==true ? "Yes" : "No" %></div> <div><label>Licenced/transfered:</label><%# Convert.ToBoolean(Eval("dbTransfer"))==true ? "Yes" : "No" %> <%# Eval("dbTransferDate")!=DBNull.Value ? "("+Eval("dbTransferDate")+")" : "" %></div> <div><label>Notes:</label><span class="lightBorder"><%# Eval("dbNotes") %></span></div> <div><label>Additional notes:</label><span class="lightBorder"><%# Eval("dbRejectReason") %></span></div> <div><label>Admin user:</label><%# Eval("dbAdminUser") %></div> <div><label>Assigned owner:</label><%# Eval("dbOwner") %></div> </fieldset> <fieldset><asp:LinkButton ID="btnEditMode" runat="server" Text="Edit details" OnClick="EditDetails" CssClass="Standard" /></fieldset> </ItemTemplate> <EditItemTemplate> <fieldset><legend>Entry ID</legend> <div><label>ID Number:</label><%# Eval("ID") %></div> <div><label>Added:</label><%# Eval("dbAdded") %></div> <div><label>Last amended:</label><%# Eval("dbLastAmended") %></div> </fieldset> <fieldset><legend>Inventor details</legend> <div><label>Inventor:</label><%# Eval("inName") %></div> <div><label>Telephone:</label><%# Eval("inTel") %></div> <div><label>Email:</label><%# Eval("inEmail") %></div> </fieldset> <fieldset><legend>Entry details</legend> <div><label>Title:</label><asp:TextBox ID="dbTitle" runat="server" text='<%# Bind("dbTitle") %>' Columns="50" MaxLength="200" ></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="dbTitle" Display="Dynamic" SetFocusOnError="True" ErrorMessage="Enter a title"></asp:RequiredFieldValidator></div> <div><label>Approved:</label><%# Convert.ToBoolean(Eval("dbApproved")) == true ? "Approved" : "No"%></div> <div><label>Archived:</label><asp:CheckBox ID="dbArchived" runat="server" Checked='<%# Bind("dbArchived") %>' OnCheckedChanged="dbArchived_OnCheckedChanged" AutoPostBack="true" /> <asp:TextBox ID="dbDateArchived" runat="server" Columns="12" MaxLength="12" Text='<%# Bind("dbDateArchived") %>'></asp:TextBox> <asp:ImageButton ID="imgCal" runat="server" ImageUrl="~/_sitefiles/_images/calender.gif" AlternateText="Display calendar" /> <cc1:CalendarExtender ID="calDateArchived" runat="server" TargetControlID="dbDateArchived" PopupButtonID="imgCal" Format="dd/MMM/yyyy" CssClass="MyCalendar" /></div> <div><label>Paper file:</label><asp:CheckBox ID="dbPaperFile" runat="server" Checked='<%# Bind("dbPaperFile") %>' /></div> <div><label>Licenced/transfered:</label><asp:CheckBox ID="dbTransfer" runat="server" Checked='<%# Bind("dbTransfer") %>' /> <asp:TextBox ID="dbTransferDate" runat="server" Columns="12" MaxLength="12" Text='<%# Bind("dbTransferDate") %>'></asp:TextBox> <asp:ImageButton ID="imgCal1" runat="server" ImageUrl="~/_sitefiles/_images/calender.gif" AlternateText="Display calendar" /> <cc1:CalendarExtender ID="calTransferDate" runat="server" TargetControlID="dbTransferDate" PopupButtonID="imgCal1" Format="dd/MMM/yyyy" CssClass="MyCalendar" /></div> <div><label>Notes:</label><span class="lightBorder"><%# Eval("dbNotes") %></span></div> <div><label>Additional notes:</label><span class="lightBorder"><%# Eval("dbRejectReason") %></span></div> <div><label>Admin user:</label><%# Eval("dbAdminUser") %></div> <div><label>Assigned owner:</label><%# Eval("dbOwner") %></div> </fieldset> <fieldset><asp:LinkButton ID="btnUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Update" CssClass="Standard"></asp:LinkButton> <asp:LinkButton ID="btnCancel" runat="server" Text="Cancel edit" OnClick="CancelEdit" CssClass="Standard" /></fieldset> </EditItemTemplate> <EmptyDataTemplate> <p>No data found</p> </EmptyDataTemplate> </asp:FormView> </div> </div> </asp:Content>ramireddyind...
All-Star
31358 Points
4579 Posts
Re: Checkbox not firing when unchecking using OnCheckedChanged
Aug 28, 2008 08:28 AM|LINK
can you post your database tables script and stored procedures?
Icemania
Member
100 Points
148 Posts
Re: Checkbox not firing when unchecking using OnCheckedChanged
Aug 28, 2008 08:39 AM|LINK
Sure, table scripts:
/****** Object: Table [dbo].[appBase_Stage1] Script Date: 08/28/2008 09:33:11 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[appBase_Stage1](
[dbID] [int] IDENTITY(1,1) NOT NULL,
[dbAdded] [int] NOT NULL,
[dbTitle] [dbo].[VarC_200] NULL,
[dbApproved] [bit] NOT NULL,
[dbRejected] [bit] NOT NULL,
[dbArchived] [bit] NOT NULL,
[dbInventorLinkID] [int] NULL,
[dbLastAmended] [int] NULL,
[dbGeneratedCode] [varchar](10) NULL,
[dbRejectReason] [varchar](500) NULL,
[dbDateArchived] [int] NULL,
[dbAdminUser] [int] NULL,
[dbEnquiry] [bit] NULL,
[dbEnquiryType] [int] NULL,
[dbConvertDate] [int] NULL,
[dbOwner] [int] NULL,
[dbType] [varchar](3) NULL CONSTRAINT [DF_tblAppPartA_pAType] DEFAULT ('_'),
[dbCompetition] [bit] NULL CONSTRAINT [DF_tblAppPartA_pACompetition] DEFAULT ((0)),
[dbLegal] [bit] NULL,
[dbPaperFile] [bit] NULL,
[dbTransfer] [bit] NULL,
[dbTransferDate] [int] NULL,
[dbHearAboutUs] [varchar](6) NULL,
[dbHearAboutOther] [dbo].[VarC_100] NULL,
[dbNotes] [varchar](max) NULL,
CONSTRAINT [PK_tblAppPartA] PRIMARY KEY CLUSTERED
(
[dbID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Previous: tblAppPartA
Used to hold the base information about an Idea' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'appBase_Stage1'
/****** Object: Table [dbo].[appSystemAdminUsers] Script Date: 08/28/2008 09:36:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[appSystemAdminUsers](
[adID] [int] IDENTITY(1,1) NOT NULL,
[adName] [varchar](30) NOT NULL,
[adInitials] [varchar](4) NULL,
[adEmail] [varchar](120) NULL,
[adSuspend] [bit] NOT NULL,
CONSTRAINT [PK_tblAppAdminUsers] PRIMARY KEY CLUSTERED
(
[adID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
/****** Object: Table [dbo].[appSystemTrusts] Script Date: 08/28/2008 09:37:06 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[appSystemTrusts](
[trustID] [int] IDENTITY(1,1) NOT NULL,
[trustName] [varchar](250) NOT NULL,
CONSTRAINT [PK_tblAppTrusts] PRIMARY KEY CLUSTERED
(
[trustID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
Stored procedure:
ramireddyind...
All-Star
31358 Points
4579 Posts
Re: Checkbox not firing when unchecking using OnCheckedChanged
Aug 28, 2008 09:06 AM|LINK
sorry, i again failed to execute your page, even data didn't retriving. it said there is no table "appforums". so i came up with an alternative way.
here what you wants to do is when user unchecked checkbox, you wants to erase the contents of textbox.
so then follow this process
implement prerender event and write code like below
protected void fvMain_PreRender(object sender, EventArgs e) { if (fvMain.DefaultMode == FormViewMode.Edit) { CheckBox dbArchived = (CheckBox)fvMain.FindControl("dbArchived"); TextBox txtDate = (TextBox)fvMain.FindControl("dbDateArchived"); string str = "javascript:return Validate('" + txtDate.ClientID + "')"; dbArchived.Attributes.Add("onclick", str); } }Ganesh@Nilgr...
Contributor
6074 Points
2354 Posts
Re: Checkbox not firing when unchecking using OnCheckedChanged
Aug 28, 2008 09:36 AM|LINK
Please Mark As Answer If my reply helped you.
Icemania
Member
100 Points
148 Posts
Re: Checkbox not firing when unchecking using OnCheckedChanged
Aug 28, 2008 01:35 PM|LINK
Finally sorted out the problem. In the master page I had the EnableViewState set to False, but in the acutal page I had this set to true, so I would have thought it would override the master page setting. Well apparently it doesn't, once I set the viewstate to true in the master page it started working.
Could anyone tell me if this is right I thought you could override the master page setting.
Anyway thanks for those that tried to help much appreciated.