I have created my custom field type to list the users available in the Dropdownlist, from my field category, from the SPFieldChoice and FieldControl class inheritance DropDownChoiceField has succession. Now I have written code within FieldControl class,
this.ddlInfoBox = new DropDownList (); SPS ite site = SPContext.GetContext (this.Context) .site; SPWeb cWeb = SPContext.Current.Web; Hashtable HT = new hashtable (); SPUserCollection spUsers = cWeb.AllUsers; Foreach (SPUser items) in SPUsers {SPFieldUser o = new SPFieldUser (ht.Add (item.Name, item);} this.ddlInfoBox.DataTextField = "key"; this.ddlInfoBox.DataValueField = "value"; this.ddlInfoBox Detasors = Ht; this.ddlInfoBox.DataBind ();
I'm trying to render the dropdown list with the user name. Now the value property is,
get public override object values {X {EnsureChildControls (); it return.ddlInfoBox.SelectedValue;} set {EnsureChildControls (); this.ddlInfoBox.SelectedValue = (string) this.ItemFieldValue;}}
Assume that I type custom field type When I use this field in a list named "field" and try to create a list item, then I will show the user available for this site, when I will create an item the data will be stored selected as a string to the user and when I filter user value in that list as an attempt to see as web parts that I do not [value] I've given me the Stavejh, it is not a string did not because I SPFieldUser value. I normally people and groups how can store that box field type stores as a SPFieldUser the string value?
Can not you get from SPFieldUser instead of SPFieldChoice? And use UserField for DropDownChoiceField?
Comments
Post a Comment