IField or IWebPartField How to

R

rote

THis code below was using the IField interface but apparently its deprecated
i changed it to use IWebpartField
but can't get it to work>
I'm havinfg a problem on this line at:- object fieldValue =
_data.GetFieldValue

Sample code below ans thanks in Adv



private IWebPartField _data;

private string _zipCode = String.Empty;

[Personalizable]

[WebBrowsable]

public string ZipCode {

get {

return _zipCode;

}

set {

_zipCode = value;

}

}

protected override void RenderContents(HtmlTextWriter writer) {

if (_data != null) {

object fieldValue = _data.GetFieldValue

if (fieldValue != null) {

_zipCode = fieldValue.ToString();

}

}

if ((_zipCode == null) || (_zipCode.Length == 0)) {

writer.Write("Select a zip code by personalizing this WebPart, or connecting
this WebPart to a Zip Code Provider.");

}

else {

writer.Write(String.Format(HtmlFormat, _zipCode));

}

}

[ConnectionConsumer("ZipCode")]

private void SetFieldConnectionData(IWebPartField data)

{

_data = data;

}

}
 
A

Alvin Bruney [MVP]

Yes, IField is deprecated. You don't really need IWebPartField to move data
between web parts either strictly speaking but it is a good approach as
well.

Here's a link that i refer to often, it will help you sort out your issues.
http://msdn2.microsoft.com/en-us/li...ebcontrols.webparts.iwebpartfield(VS.80).aspx

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
https://www.microsoft.com/MSPress/books/10933.aspx
OWC Black Book www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top