473,770 Members | 5,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IPostBackDataHa ndler problem

Hi,

Im developing a RibbonBar Control in asp.net 1.1 by converting already
done in asp.net 2.0.
My problem is that theres no compositecontro l in 1.1. Correct me if im
wrong, heres what i want to achieve.

My RibbonButton control is a regular webcontrol. RibbonButton
instantiates a hiddenfield inside by creating new instance. So we have
simple situation here wheres RibbonControl that contains hiddenfield
control inside.
Note that aps.net 1.1 does not have hidden fields so i created my own
listed below:

public class SharedStateHidd enField : WebControl, IPostBackDataHa ndler
{
public string Value
{
get { return ViewState["Value"] != null ? (string)ViewSta te["Value"]
: string.Empty; }
set { ViewState["Value"] = value; }
}

protected override void AddAttributesTo Render(HtmlText Writer writer)
{
writer.AddAttri bute(HtmlTextWr iterAttribute.I d, ClientID);
writer.AddAttri bute(HtmlTextWr iterAttribute.N ame, ClientID);
writer.AddAttri bute(HtmlTextWr iterAttribute.V alue, Value);
writer.AddAttri bute(HtmlTextWr iterAttribute.T ype, "hidden");
}

protected override HtmlTextWriterT ag TagKey
{
get
{
return HtmlTextWriterT ag.Input;
}
}
#region IPostBackDataHa ndler Members

public void RaisePostDataCh angedEvent()
{

}

bool IPostBackDataHa ndler.LoadPostD ata(string postDataKey,
System.Collecti ons.Specialized .NameValueColle ction values)
{
return LoadPostData(po stDataKey, values);
}
protected virtual bool LoadPostData(st ring postDataKey,
System.Collecti ons.Specialized .NameValueColle ction values)
{
string val = values[this.ClientID];
bool changed = false;
if (val != Value)
{
Value = val;
changed = true;
}
return changed;
}

#endregion
}
}

So, when i do postback on whatever control on my page, this
IPostBackDataHa ndler in my hidden field is not fired !

i want it to be fired and thats my question, why ?

Do you possibly know what is wrong ?

regards, Peter
Sep 5 '07 #1
4 1833
My problem is that theres no compositecontro l in 1.1. Correct me if im
wrong, heres what i want to achieve.
Composite controls come from 1.xx . Try this:
http://www.microsoft.com/MSPress/books/5728.aspx
Cheers
Smith
Sep 5 '07 #2
Smith pisze:
>My problem is that theres no compositecontro l in 1.1. Correct me if im
wrong, heres what i want to achieve.

Composite controls come from 1.xx . Try this:
http://www.microsoft.com/MSPress/books/5728.aspx
Cheers
Smith

Ok Found the problem.
I used clientId instead of uniqueId property, ma fault.

here's the correct code for hiddenfield control in asp.net 1.1 :)

public class SharedStateHidd enField : WebControl, IPostBackDataHa ndler
{
public string Value
{
get { return ViewState["Value"] != null ? (string)ViewSta te["Value"]
: string.Empty; }
set { ViewState["Value"] = value; }
}

protected override void AddAttributesTo Render(HtmlText Writer writer)
{
writer.AddAttri bute(HtmlTextWr iterAttribute.I d, ClientID);
writer.AddAttri bute(HtmlTextWr iterAttribute.N ame, UniqueID);
writer.AddAttri bute(HtmlTextWr iterAttribute.V alue, Value);
writer.AddAttri bute(HtmlTextWr iterAttribute.T ype, "hidden");
}

protected override HtmlTextWriterT ag TagKey
{
get
{
return HtmlTextWriterT ag.Input;
}
}
#region IPostBackDataHa ndler Members

public void RaisePostDataCh angedEvent()
{

}

bool IPostBackDataHa ndler.LoadPostD ata(string postDataKey,
System.Collecti ons.Specialized .NameValueColle ction values)
{
return LoadPostData(po stDataKey, values);
}
protected virtual bool LoadPostData(st ring postDataKey,
System.Collecti ons.Specialized .NameValueColle ction values)
{
string val = values[this.UniqueID];
bool changed = false;
if (val != Value)
{
Value = val;
changed = true;
}
return changed;
}

#endregion
}
Sep 5 '07 #3


"Piotr Nowak" <p.******@STRIP THISwasko.plwro te in message
news:fb******** **@atlantis.new s.tpi.pl...
Note that aps.net 1.1 does not have hidden fields so i created my own
listed below:

What do you mean 1.1 doesn't have hidden fields?!? Check out the
System.Web.UI.H tmlControls namespace and look for the HtmlInputHidden
control. :)

HTH,
Mythran
Sep 5 '07 #4
Mythran pisze:
>

"Piotr Nowak" <p.******@STRIP THISwasko.plwro te in message
news:fb******** **@atlantis.new s.tpi.pl...
>Note that aps.net 1.1 does not have hidden fields so i created my own
listed below:


What do you mean 1.1 doesn't have hidden fields?!? Check out the
System.Web.UI.H tmlControls namespace and look for the HtmlInputHidden
control. :)

HTH,
Mythran

oh, right :)
i think i was suggested by some news article saying that asp.net 2.0 has
some new features like the new HiddenField component.

anyway, thanks :)
Sep 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

117
7265
by: Peter Olcott | last post by:
www.halting-problem.com
28
5222
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass(); .... and then call the virtual method, why is it that the base class's method is called instead of the overridden method? How do I fix this if I don't know at runtime what the child class is? I'm using Activator.CreateInstance() to load the...
0
431
by: One Handed Man \( OHM - Terry Burns \) | last post by:
I have implemented the System.Web.UI.IPostBackDataHandler.LoadPostData interface in my custom control, however, when I submit this Function is not called by ASP.NET ( Which is what I assume is supposed to happen ). Unfortunately it does not get called, any ideas what could be causing this ? --
6
2054
by: Francois | last post by:
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...
6
3812
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length is more that 1249 bytes, then the progress bar of the browser will move too slow and then displaying that the page not found!!!! If the message is less than or equal to 1249 then no problem.
9
2373
by: brian.mills | last post by:
I've been building some custom controls which have some special functionality with the data I use from a web service, specifically the ability to data bind to attributes (without an accessor method). However I've come accross an interesting issue with using them. I have reimplemented the class from public class WCCombobox : Control, IPostBackDataHandler so that I can load the post data back in. It works great, it gets to the method and...
1
2700
by: z f | last post by:
Hi. How can I make a custom control in VB.NET that is inheriting from TextBox and also implements/inherits the IPostBackDataHandler? the problem is that in VB.NET I can't inherit from more that one class, but when I try to inherit from TextBox and Implement IPostBackDataHandler i get an error of "Interface 'System.Web.UI.IPostBackDataHandler' is already implemented by base class 'System.Web.UI.WebControls.TextBox'." but if I want to...
0
908
by: Martin Gustavsson | last post by:
I'm a bit puzzled by the IPostBackDataHandler. What if i have a custom control that I render myself, and I render 30 input-fields. They can't all have the name of the control's UniqueID? Which is required if LoadPostData is to be invoked (Note: Theese are not child controls, they are simply rendered input-fields). My input fields will probably be named something like UniqueID + ":some_internal_id". One solution I can come up with is to...
4
1660
by: Nathan Sokalski | last post by:
During my postbacks, I try to assign the value from an Input tag to a property of a custom control. However, I keep recieving the following error: An exception of type 'System.OverflowException' occurred in Microsoft.VisualBasic.dll but was not handled in user code Additional information: Arithmetic operation resulted in an overflow. The code that it highlights during this error is the 2nd line of the
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.