Hi Filip,
I have done this as you mentioned. Please check the following code. Now dropdown picking up the required values from custom table. The issue is when the dropdown selection changed its not fires , I have put auto post back true . Also On "DropDownList1_SelectedIndexChanged" I want to get the selected item and get the relevant exam fee for selected item. Can you please tell me how can I put a where condition on GetItems function with selected item.
<asp:DropDownList ID="DropDownList1" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" runat="server" AutoPostBack="True"></asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
if (DropDownList1.Items.Count == 0)
{
// Create new Custom table item provider
CMS.SiteProvider.CustomTableItemProvider customTableProvider = new CMS.SiteProvider.CustomTableItemProvider(CMSContext.CurrentUser);
string customTableClassName = "customtable.ExamFees";
// Check if Custom table 'customtable.ExamFees' exists
CMS.SettingsProvider.DataClassInfo customTable = CMS.SettingsProvider.DataClassInfoProvider.GetDataClass(customTableClassName);
if (customTable != null)
{
DataSet dataSet = customTableProvider.GetItems("customtable.ExamFees", null, null);
int count = dataSet.Tables[0].Rows.Count;
if (!CMS.GlobalHelper.DataHelper.DataSourceIsEmpty(dataSet))
{
for (int i = 0; i < count; i++)
{
DropDownList1.Items.Add(new ListItem(dataSet.Tables[0].Rows["Exam"].ToString()));
}
}
}
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string v = DropDownList1.SelectedItem.ToString();
TextBox1.Text = v;
}