F
Francois
Hi,
I am trying to implement a custom control that extends the standard
System.Web.UI.WebControls.CheckBox control. In the .Net class library
reference it is said that CheckBox Implements IPostBackDataHandler
interface. I want to override the 2 methods defined by that interface but i
do not see in the CheckBox class that the methods of IPostBackDataHandler
are implemented. But they should be as the class is said to implement the
interface.
The 2 methods defined by IPostBackDataHandler are:
- RaisePostDataChangedEvent
- LoadPostData
Then how cam I create a custom control that extends CheckBox and overrides
RaisePostDataChangedEven and LoadPostData?
I tried to following code but it does not compile, it says the
CheckBoxValue.cs: 'Bos.CustomControls.CheckBoxValue.LoadPostData(string,
System.Collections.Specialized.NameValueCollection)': no suitable method
found to override
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace Bos.CustomControls
{
public class CheckBoxValue : System.Web.UI.WebControls.CheckBox
{
private bool isChanged = false;
public CheckBoxValue()
{
}
public bool IsChanged
{
get
{
return this.isChanged;
}
set
{
this.isChanged = value;
}
}
protected override void OnCheckedChanged(EventArgs e)
{
IsChanged = true;
base.OnCheckedChanged(e);
}
protected override bool LoadPostData( string postDataKey,
NameValueCollection postCollection)
{
}
}
}
Best regards,
Francois
I am trying to implement a custom control that extends the standard
System.Web.UI.WebControls.CheckBox control. In the .Net class library
reference it is said that CheckBox Implements IPostBackDataHandler
interface. I want to override the 2 methods defined by that interface but i
do not see in the CheckBox class that the methods of IPostBackDataHandler
are implemented. But they should be as the class is said to implement the
interface.
The 2 methods defined by IPostBackDataHandler are:
- RaisePostDataChangedEvent
- LoadPostData
Then how cam I create a custom control that extends CheckBox and overrides
RaisePostDataChangedEven and LoadPostData?
I tried to following code but it does not compile, it says the
CheckBoxValue.cs: 'Bos.CustomControls.CheckBoxValue.LoadPostData(string,
System.Collections.Specialized.NameValueCollection)': no suitable method
found to override
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace Bos.CustomControls
{
public class CheckBoxValue : System.Web.UI.WebControls.CheckBox
{
private bool isChanged = false;
public CheckBoxValue()
{
}
public bool IsChanged
{
get
{
return this.isChanged;
}
set
{
this.isChanged = value;
}
}
protected override void OnCheckedChanged(EventArgs e)
{
IsChanged = true;
base.OnCheckedChanged(e);
}
protected override bool LoadPostData( string postDataKey,
NameValueCollection postCollection)
{
}
}
}
Best regards,
Francois