01.07.2009
Register     Login      
 
DotNetNuke Platinum Benefactor

We're happy to show our support for the DotNetNuke platform and community by contributing back to the project at the highest "Platinum" level.

XMod Form & Template Exchange Highlights
Here's a few of the latest additions to the XMod Form & Template Exchange. The Exchange contains snippets, samples, and solutions. It's free and open to all XMod users. We encourage you to use the samples and submit your own.

Visit the Exchange
Contribute to the Exchange

Dropdown List Search Form
by Angus Beare
Mashups for XMOD
by Ray Chance
Java Enabled form with email
by Tony Smith
YouTube Video Include
by Patrick Cummings
BrightCove Player using the BrightCove ID ( Flash Player)
by Craig Porter
Kill the 'Edit Item' title
by Eric Mourant
Fading News Ticker
by Kelly Ford
GymnasticsMedia Store
by GymnasticsMedia
Parent Child Relationship For Categories (Select1)
by Ben Bahrenburg
Link Exchange
by Ben Bahrenburg
Powered By XMod
DNNDev.com Forums
Subject: Data not showing in custom control
Prev Next
You are not authorized to post a reply.

Author Messages
ceciltechUser is Offline
XMod Newcomer
XMod Newcomer
Posts: 3




9/28/2005 9:18 AM  
Hello,
I am trying to create a very simple form control that inherits from the standard TextBox class. Eventually this control will encrypt it's data before storing it or sending e-mail, for now it just adds an 's' in front. The controls data is saved with the 's' but when I go to edit the record my control is always empty even though the data is in the record? I have attached the very simple class file. I know this should be very easy could you please tell me what I am doing wrong?

DNN 3.1.1
and
DNN3_XMod324

Cecil

PS If I get it working I will make it freely available.

Attachment: 192818528171.zip

dnndevUser is Offline
XMod All-Star
XMod All-Star
Posts: 4621

dnndev.com
Broadcasting Live from Somewhere in Arizona


9/28/2005 11:56 AM  
Hi Cecil,

Have you tried this control in a non-XMod context - i.e. on a regular aspx page to ensure it's saving it's data between postbacks?

Best,
Kelly

Put the power of XMod to work for you today
Purchase XMod from Snowcovered
ceciltechUser is Offline
XMod Newcomer
XMod Newcomer
Posts: 3




9/28/2005 1:46 PM  
Kelly,
Thank you for the quick reply...but I don't think postbacks are involved here. The control saves fine but when I go to edit an existing record the control comes up empty even though the template shows the data and it is in the table. Since my control was never created for display of the template then postback is not the issue. If you take a moment to look at the very short class file I attached you will see that all I am doing is inheriting from textbox and implementing your IFormControl interface and then overriding the Text property of the Textbox(I also tried with no override of Text, same problem). This is about the simplest control you could possibly create I must be missing something basic or your code has a serious bug.

Cecil
dnndevUser is Offline
XMod All-Star
XMod All-Star
Posts: 4621

dnndev.com
Broadcasting Live from Somewhere in Arizona


9/28/2005 3:14 PM  
Hi Cecil,

I've tracked the issue down. The problem stems from the fact that your control inherits from, rather than encapsulating, the TextBox control. The logic is seeing it as a text box first and processing it as such, preventing it from being processed as a custom control. I'll change the logic to ensure custom form controls directly inherited from server controls are processed appropriately.

In the meantime, you can workaround this by not inheriting from the TextBox. Instead, inherit from System.Web.UI.Control or System.Web.UI.WebControls.WebControl. Override CreateChildControls() and in that procedure, add the TextBox to your control's Controls collection.

Best,
Kelly

Put the power of XMod to work for you today
Purchase XMod from Snowcovered
ceciltechUser is Offline
XMod Newcomer
XMod Newcomer
Posts: 3




9/30/2005 8:35 AM  
Kelly,
Worked like a charm. Thank you for the quick response!

Cecil
timrolandsUser is Offline
XMod Jr. Varsity
XMod Jr. Varsity
Posts: 20




9/28/2006 4:55 PM  
Cecil, we are trying to do something just like this, but we're not having much luck. Glad I found this thread.

Any chance you could post your revised code? I'd like to compare to what we have, because I'm not sure we're implementing Kelly's suggestion correctly.

Thanks!
timrolandsUser is Offline
XMod Jr. Varsity
XMod Jr. Varsity
Posts: 20




9/29/2006 8:23 AM  
Oh, never mind, Cecil. I got it working this morning! Thanks anyway.

I will see if I can get permission to share the control.

Tim
You are not authorized to post a reply.
Forums > DNNdev Forums > Extending XMod > Data not showing in custom control



ActiveForums 3.7
       Terms Of Use      Privacy Statement      © 2004-2008 Kelly Ford