本文整理汇总了C#中RadComboBox.DataBind方法的典型用法代码示例。如果您正苦于以下问题:C# RadComboBox.DataBind方法的具体用法?C# RadComboBox.DataBind怎么用?C# RadComboBox.DataBind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RadComboBox
的用法示例。
在下文中一共展示了RadComboBox.DataBind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmbCustomerProducts_OnLoad
// public void cmbCustomerProducts_OnLoad(object sender, EventArgs e)
public void cmbCustomerProducts_OnLoad(RadComboBox Box)
{
using (DataClasses1DataContext dbContext = new DataClasses1DataContext())
{
try
{
if (Session["editableProductId"] != null && !String.IsNullOrEmpty(Session["editableProductId"].ToString()))
{
string myProductId = Session["editableProductId"].ToString();
Box.Visible = true;
var myCustomers = from cust in dbContext.Customer
join lCust in dbContext.LargeCustomer on cust.Id equals lCust.CustomerId
orderby cust.Name ascending
select new
{
CustomerId = cust.Id,
CustomerName = String.IsNullOrEmpty(cust.MatchCode) ? cust.Name : cust.Name + "(" + cust.MatchCode + ")",
IsChecked = dbContext.CustomerProduct.SingleOrDefault(q => q.ProductId == Int32.Parse(myProductId) && q.CustomerId == cust.Id) != null ? true : false
};
Box.DataSource = myCustomers;
Box.DataBind();
}
}
catch (Exception ex)
{
dbContext.WriteLogItem("Product Error " + ex.Message, LogTypes.ERROR, "Product");
throw new Exception(ex.Message);
}
}
}
示例2: FillApstDDL
public static void FillApstDDL(RadComboBox ddlApst, List<TouristApstInfo> lstTouristApst, int intSelected, int intTerritoryID)
{
ddlApst.DataSource = lstTouristApst;
ddlApst.DataTextField = "TuristApstakli";
ddlApst.DataValueField = "TuristApstakli_ID";
ddlApst.DataBind();
ddlApst.SelectedValue = intSelected.ToString();
}
示例3: bindComboBox
protected void bindComboBox(RadComboBox r, DataSet d)
{
r.Items.Clear();
r.DataTextField = "AutoSearchResult";
r.DataSource = d;
r.DataBind();
r.Items.Insert(0, new RadComboBoxItem("", "0"));
r.SelectedValue = "0";
}
示例4: PopulateMasterSpeciality
public void PopulateMasterSpeciality(RadComboBox rcbSpeciality)
{
DataSet dsSpeciality = objSpecialityBAL.SelectMasterSpeciality();
if (dsSpeciality.Tables.Count > 0 && dsSpeciality.Tables[0].Rows.Count > 0)
{
rcbSpeciality.DataSource = dsSpeciality;
rcbSpeciality.DataTextField = "DepartmentName";
rcbSpeciality.DataValueField = "DepartmentId";
rcbSpeciality.DataBind();
}
RadComboBoxItem CountryListItem = new RadComboBoxItem("--Select--", "--Select--");
rcbSpeciality.Items.Insert(0, CountryListItem);
}
示例5: cmbCustomerProducts_OnLoad
// public void cmbCustomerProducts_OnLoad(object sender, EventArgs e)
public void cmbCustomerProducts_OnLoad(RadComboBox Box)
{
using (DataClasses1DataContext dbContext = new DataClasses1DataContext())
{
try
{
//RadComboBox cmbCustomerProducts = ((RadComboBox)sender);
//cmbCustomerProducts.Items.Clear();
//cmbCustomerProducts.Text = string.Empty;
if (Session["editableProductId"] != null && Session["editableProductId"].ToString() != string.Empty)
{
string myProductId = Session["editableProductId"].ToString();
Box.Visible = true;
//var myCustomers = from cust in dbContext.Customer
// join custProd in dbContext.CustomerProduct on cust.Id equals custProd.CustomerId into JoinedCustProd
// from custProd in JoinedCustProd.DefaultIfEmpty()
// orderby cust.Name ascending
// select new
// {
// CustomerId = cust.Id,
// CustomerName = cust.Name,
// IsChecked = custProd.ProductId == new Guid(Session["selectedProductId"].ToString()) ? true : false
// };
var myCustomers = from cust in dbContext.Customer
join lCust in dbContext.LargeCustomer on cust.Id equals lCust.CustomerId
orderby cust.Name ascending
select new
{
CustomerId = cust.Id,
CustomerName = String.IsNullOrEmpty(cust.MatchCode) ? cust.Name : cust.Name + "(" + cust.MatchCode + ")",
IsChecked = dbContext.CustomerProduct.SingleOrDefault(q => q.ProductId == new Guid(myProductId) && q.CustomerId == cust.Id) != null ? true : false
};
Box.DataSource = myCustomers;
Box.DataBind();
//cmbCustomerProducts.DataSource = myCustomers;
//cmbCustomerProducts.DataBind();
}
}
catch (Exception ex)
{
dbContext.WriteLogItem("Product Error " + ex.Message, LogTypes.ERROR, "Product");
throw new Exception(ex.Message);
}
}
}
示例6: getComboList_ID_Name
public void getComboList_ID_Name(empStatus eStatus, RadComboBox cbx)
{
sqlStr = "EXEC proc_Get_EmpInfoIdName '" + (int)eStatus + "'";
sqlCon = new SqlConnection(cnStr);
sqlCon.Open();
sqlDA = new SqlDataAdapter(sqlStr, sqlCon);
dTable = new DataTable();
sqlDA.Fill(dTable);
cbx.DataSource = dTable;
cbx.DataTextField = "FullName";
cbx.DataValueField = "EmpId";
cbx.DataBind();
sqlCon.Close();
sqlCon.Dispose();
}
示例7: LoadLithostratGroup
/// <summary>
/// Loads the lithostrat group controls.
/// </summary>
private void LoadLithostratGroup(string listName, string filteredValue, RadComboBox radCboLithostratGroup, string dataTextField, string dataValueField)
{
DataTable dtLithostratGroup = null;
try
{
dtLithostratGroup = GetDataSource(listName, filteredValue);
if (dtLithostratGroup != null && dtLithostratGroup.Rows.Count > 0)
{
radCboLithostratGroup.DataSource = dtLithostratGroup;
radCboLithostratGroup.DataTextField = dataTextField;
radCboLithostratGroup.DataValueField = dataValueField;
radCboLithostratGroup.DataBind();
radCboLithostratGroup.Items.Insert(0, new RadComboBoxItem(DEFAULTDROPDOWNTEXT));
radCboLithostratGroup.SelectedIndex = 0;
}
else
{
radCboLithostratGroup.ErrorMessage = NORECORDFOUNDSEXCEPTIONMESSAGE;
}
}
catch (SoapException soapEx)
{
if (soapEx.Message.Equals(SOAPEXCEPTIONMESSAGE))
{
radCboLithostratGroup.ErrorMessage = NORECORDFOUNDSEXCEPTIONMESSAGE;
}
else
{
radCboLithostratGroup.ErrorMessage = UNEXPECTEDEXCEPTIONMESSAGE;
CommonUtility.HandleException(strCurrSiteURL, soapEx, 1);
}
}
catch (WebException webEx)
{
radCboLithostratGroup.ErrorMessage = UNEXPECTEDEXCEPTIONMESSAGE;
CommonUtility.HandleException(strCurrSiteURL, webEx, 1);
}
catch (Exception ex)
{
CommonUtility.HandleException(strCurrSiteURL, ex);
}
finally
{
if (dtLithostratGroup != null)
{
if (dtLithostratGroup.DataSet != null)
dtLithostratGroup.DataSet.Dispose();
dtLithostratGroup.Dispose();
}
}
}
示例8: PopulateRadComboBox
/// <summary>
/// Populates the RAD combo box.
/// </summary>
/// <param name="e">The <see cref="Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs"/> instance containing the event data.</param>
/// <param name="sourceListName">Name of the source list.</param>
/// <param name="valueFieldName">Name of the value field.</param>
/// <param name="textFieldName">Name of the text field.</param>
private void PopulateRadComboBox(RadComboBoxItemsRequestedEventArgs e, RadComboBox objRadComboBox, string sourceListName, string valueFieldName, string textFieldName)
{
DataTable dtFieldName = null;
StringBuilder strUserEnteredValue = new StringBuilder();
try
{
if(!string.IsNullOrEmpty(e.Text))
{
strUserEnteredValue.Append(e.Text);
//Commented in DREAM 4.0 For R%K Changes
/*if(!sourceListName.Equals(BASINLIST))
{
if(!strUserEnteredValue.ToString().Contains("*"))
{
strUserEnteredValue.Append("*");
}
}
else
{
char[] charSpecialCharacter = { '*', '%' };
if(strUserEnteredValue.ToString().Contains("*") || strUserEnteredValue.ToString().Contains("%"))
{
strUserEnteredValue.Remove(strUserEnteredValue.ToString().IndexOfAny(charSpecialCharacter), (strUserEnteredValue.ToString().Length - strUserEnteredValue.ToString().IndexOfAny(charSpecialCharacter)));
}
}*/
//Added in DREAM 4.0 For R%K Changes
//Starts
if(!strUserEnteredValue.ToString().Contains("*"))
{
strUserEnteredValue.Append("*");
}
//Ends
dtFieldName = GetDataForComboBox(strUserEnteredValue.ToString(), sourceListName);
if(dtFieldName != null && dtFieldName.Rows.Count > 0)
{
int intItemsPerRequest = 111;
int intItemOffset = e.NumberOfItems;
int intEndOffset = Math.Min(intItemOffset + intItemsPerRequest, dtFieldName.Rows.Count);
e.EndOfItems = intEndOffset == dtFieldName.Rows.Count;
objRadComboBox.DataSource = dtFieldName;
objRadComboBox.DataTextField = textFieldName;
objRadComboBox.DataValueField = valueFieldName;
objRadComboBox.DataBind();
e.Message = dtFieldName.Rows.Count.ToString();
}
else
{
e.Message = NORECORDFOUNDSEXCEPTIONMESSAGE;
}
}
}
finally
{
if(dtFieldName != null)
dtFieldName.Dispose();
}
}
示例9: LoadComboBox
public void LoadComboBox(RadComboBox RadDropDown, string SQL, string DisplayField, string ValueField, string[] WhereCluseValue)
{
AppManager am = new AppManager();
DataTable dt = am.DataAccess.RecordSet(SQL, WhereCluseValue);
DataRow dRow = dt.NewRow();
dRow[ValueField] = "0";
dRow[DisplayField] = "";
dt.Rows.Add(dRow);
RadDropDown.DataSource = dt;
RadDropDown.DataTextField = DisplayField;
RadDropDown.DataValueField = ValueField;
RadDropDown.DataBind();
RadDropDown.SelectedValue = "0";
}
示例10: BindComboBox
private void BindComboBox(RadComboBox comboBox, bool hasAll, ItemType type)
{
string text = string.Empty;
string value = string.Empty;
comboBox.Items.Clear();
switch (type)
{
case ItemType.AllRoles:
text = "rolename";
value = "roleid";
comboBox.DataSource = AllRoles;
break;
case ItemType.AllSchools:
text = "name";
value = "id";
comboBox.DataSource = AllSchools;
break;
case ItemType.AllSchoolTypes:
text = "name";
value = "name";
comboBox.DataSource = AllSchoolTypes;
break;
case ItemType.AllPortals:
text = "portalname";
value = "id";
comboBox.DataSource = adm.GetPortalSelections();
break;
}
comboBox.DataTextField = text;
comboBox.DataValueField = value;
comboBox.DataBind();
if (hasAll)
{
comboBox.Items.Add(new RadComboBoxItem("All", "All"));
}
}
示例11: BindEmployeeCombo
private void BindEmployeeCombo(RadComboBox sender)
{
objUserMasterDAL = new UserMasterDal();
sender.Items.Clear();
sender.ClearSelection();
sender.DataTextField = "EMP_NAME";
sender.DataValueField = "EMP_ID";
sender.DataSource = objUserMasterDAL.GetEmployeeKeyValue();
sender.DataBind();
sender.Items.Insert(0, new RadComboBoxItem("", "0"));
sender.SelectedValue = "0";
}
示例12: LoadControlToPage
//.........这里部分代码省略.........
date.Font.Bold = true; date.Font.Name = "Times New Roman";
date.Font.Size = 12;
date.SelectedDate = DateTime.Now;
date.TabIndex = TabIndex;
Panel.Controls.Add(date);
}
if (sCate == "ComboBox")
{
RadComboBox com = new RadComboBox();
com.Skin = "Vista";
com.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Height"])*5;
com.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Width"]);
com.ID = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Code"].ToString();
com.EnableVirtualScrolling = true;
string SQL = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Data_SQL"].ToString();
if (SQL.Length > 0)
{
DataTable _dt;
if (_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["IsSP"] != null && Convert.ToBoolean(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["IsSP"]) == true)
{
int Index = SQL.IndexOf('@');
if (Index >= 0)
_dt = objUser.GetSP(SQL.Substring(0, Index), SQL.Substring(Index, SQL.Length - Index), Session["UserId"] == null ? "0" : Session["UserId"].ToString());
else
_dt = objUser.GetSP(SQL);
}
else
_dt = objUser.GetSQL(SQL);
com.DataValueField = "ID";
com.DataTextField = "Name";
com.DataSource = _dt;
com.DataBind();
}
com.TabIndex = TabIndex;
Panel.Controls.Add(com);
}
TabIndex++;
}
}
else
{
LB = new Label();
string str = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Name"].ToString() + ": ";
LB.Text = str;
Panel.Controls.Add(LB);
if (str.Length < strMax.Length)
{
string sadd = "";
for (int y = 0; y <= strMax.Length - str.Length; y++)
sadd += " ";
HtmlAnchor add = new HtmlAnchor();
add.InnerHtml = sadd;
Panel.Controls.Add(add);
}
string sCate = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Control_Type"].ToString();
if (sCate == "TextBox")
{
TextBox TB = new TextBox();
TB.ID = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Code"].ToString();
TB.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Height"]);
TB.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Width"]);
TB.TabIndex = TabIndex;
示例13: bindCountryCombo
private void bindCountryCombo(RadComboBox sender, DataSet source)
{
objBindCombo = new BindCombo();
sender.Items.Clear();
sender.ClearSelection();
sender.DataTextField = "COUNTRY_NAME";
sender.DataValueField = "COUNTRY_ID";
if (source != null)
sender.DataSource = source;
else
sender.DataSource = objBindCombo.GetAirLine();
sender.DataBind();
sender.Items.Insert(0, new RadComboBoxItem("", "0"));
sender.SelectedValue = "0";
}
示例14: BindRegionCombo
//#region btnDeleteAirport_Click
//protected void btnDeleteAirport_Click(object sender, EventArgs e)
//{
// try
// {
// int serialNo = 0;
// ImageButton imgbtnDetailDelete = (ImageButton)sender;
// if (imgbtnDetailDelete != null)
// Int32.TryParse(imgbtnDetailDelete.CommandArgument, out serialNo);
// objAirlineMapDal = new AirlineMapDal();
// int result = objAirlineMapDal.DeleteAirportBySrNo(serialNo);
// if (result == 1)
// {
// Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Delete].ToString());
// Master.MessageCssClass = "successMessage";
// BindAirportGrid();
// }
// else if (result == 547)
// {
// Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Delete].ToString());
// Master.MessageCssClass = "errorMessage";
// }
// else
// {
// Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Delete].ToString());
// Master.MessageCssClass = "errorMessage";
// }
// }
// catch (Exception ex)
// {
// bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
// if (rethrow)
// { throw ex; }
// }
//}
//#endregion
#endregion
#region Method
private void BindRegionCombo(RadComboBox sender, DataSet source)
{
objBindCombo = new BindCombo();
sender.Items.Clear();
sender.ClearSelection();
sender.DataTextField = "REGION_LONG_NAME";
sender.DataValueField = "REGION_ID";
if (source != null)
sender.DataSource = source;
else
sender.DataSource = objBindCombo.GetCityKeyValue(0, 0);
sender.DataBind();
sender.Items.Insert(0, new RadComboBoxItem("", "0"));
sender.SelectedValue = "0";
}
示例15: getPaymentCurrency
public void getPaymentCurrency(RadComboBox cbx)
{
sqlStr = "SELECT * FROM Currency WHERE Active=1 ORDER BY CurrencyID ASC";
sqlCon = new SqlConnection(cnStr);
sqlCon.Open();
sqlDA = new SqlDataAdapter(sqlStr, sqlCon);
dTable = new DataTable();
sqlDA.Fill(dTable);
cbx.DataSource = dTable;
cbx.DataTextField = "CurrencyName";
cbx.DataValueField = "CurrencyID";
cbx.DataBind();
sqlCon.Close();
sqlCon.Dispose();
}