Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace FilteredWebPart.SampleFilterWebPart
- {
- [ToolboxItemAttribute(false)]
- public class SampleFilterWebPart : WebPart
- {
- private string addedString;
- protected override void CreateChildControls()
- {
- if (string.IsNullOrEmpty(this.addedString))
- {
- this.Controls.Add(new LiteralControl("Salut !"));
- }
- else
- {
- this.Controls.Add(new LiteralControl(string.Format("Tu crois vraiment que je vais chercher '{0}' pour toi ?", this.addedString)));
- }
- }
- [ConnectionConsumer("filter")]
- public void SetFilter(IWebPartField filterValues)
- {
- if (filterValues != null)
- {
- FieldCallback callback = new FieldCallback(ReceiveField);
- filterValues.GetFieldValue(callback);
- }
- else
- {
- this.addedString = string.Empty;
- }
- }
- public void ReceiveField(object objField)
- {
- if (objField != null)
- {
- this.addedString = (string)objField;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement