Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm creating a custom field. I'd like to pass some data to my control when the FieldRenderingControl property is get.

How could I do? I think about Url Rewriting but in the get I can't access the Request NOR the page or the Response.

This is my code:

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using Microsoft.SharePoint;

 namespace CustomFields
 {
 public  class AutoAssignedLookUp : SPFieldLookup
{

    public AutoAssignedLookUp(SPFieldCollection fields, string fName)
        : base(fields, fName) { }
    public AutoAssignedLookUp(SPFieldCollection fields, string tName, string dName)
        : base(fields, tName, dName) { }

public override Microsoft.SharePoint.WebControls.BaseFieldControl FieldRenderingControl
{
    get
    {
        return new AutoAssignedLookUpControl();
    }

}

public override string GetFieldValueAsHtml(object value)
{
    return base.GetFieldValueAsHtml(value);
}

public override Type FieldValueType
{
    get { return (typeof(AutoAssignedLookUp)); }
}
}
}

And for the Control simply:

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using Microsoft.SharePoint;
 using Microsoft.SharePoint.WebControls;

namespace CustomFields
{
public class AutoAssignedLookUpControl : BaseFieldControl 
{
    protected override void Render(System.Web.UI.HtmlTextWriter output)
    {
        base.Render(output);
    }

}

}

How can I pass some data to this object? How can I do this by url rewriting?

share|improve this question
    
Where is the data to be appended coming from? –  Matthias Dec 1 '11 at 10:47
    
I think URL rewriting too! –  Ziba Leah Dec 1 '11 at 10:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.