<asp:DropDownList runat="server" ID="RecordSelect" OnSelectedIndexChanged="SelectionChanged" AutoPostBack="true" >
protected void SelectionChanged(object sender, EventArgs e) { Response.Redirect("http://url/account.aspx?field1=" + ((DropDownList)sender).SelectedValue); }
protected void Load_Entity_Items(string entity_Name, string record_Name, string recordid) { using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, getCred(), null)) { serviceProxy.EnableProxyTypes(); QueryExpression qe = new QueryExpression(); qe.EntityName = entity_Name; qe.ColumnSet = new ColumnSet(); qe.ColumnSet.Columns.Add(record_Name); qe.ColumnSet.Columns.Add(recordid); OrderExpression oe = new OrderExpression(); oe.AttributeName = record_Name; oe.OrderType = OrderType.Ascending; qe.Orders.Add(oe); EntityCollection ec = serviceProxy.RetrieveMultiple(qe); List<picklistoptions> lst = new List<picklistoptions>(); foreach (Entity act in ec.Entities) { lst.Add(new PickListOptions() { ItemLabel = act[record_Name].ToString(), ItemValue = act[recordid].ToString() }); if (ec.Entities.IndexOf(act) == 24) break; } RecordSelect.DataSource = lst; RecordSelect.DataTextField = "ItemLabel"; RecordSelect.DataValueField = "ItemValue"; RecordSelect.DataBind(); RecordSelect.SelectedValue = _accountId.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Load_Entity_Items(entity_Name,record_Name,recordid) } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)