Hello,
i have a problem and i need some help please.
I have this scenario:
I have many radComboboxes inside a page and in order to make the loading time faster for the page i am using LoadOnDemand functionality.
The thing is what on the page loads, i read a Customer fields and in the Page_Load event i populate the existing rcb (radComboBoxes) with the value from the query i get from sql so the controls will dispaly the initial existing value in there.
This is the code i have for this (basically i manually add a new item with the initial customer value i read from SQL):
After that i have the ItemsRequested event where i get all the possible values for each rcb. (in this case i only show exemple for one rcb)
My problem is that when i press the SAVE button inside my form, the rcb.SelectedItem.Value will always be the first item I added by default in the Page_Load event, and not the one i select in the rcb.
Here is the HTML
Here is the C#
I know the rcb value are load on demand at the client side, but how i can make accessible form the server side, mentaining the LoadOnDemand functionality? The solution to get all the values on server side Page_Load event and bind them initially to all the rcb is not acceptable for me because of the amount of data to load from SQL
Thank you for your help
i have a problem and i need some help please.
I have this scenario:
I have many radComboboxes inside a page and in order to make the loading time faster for the page i am using LoadOnDemand functionality.
The thing is what on the page loads, i read a Customer fields and in the Page_Load event i populate the existing rcb (radComboBoxes) with the value from the query i get from sql so the controls will dispaly the initial existing value in there.
This is the code i have for this (basically i manually add a new item with the initial customer value i read from SQL):
radCtrl.Items.Clear();
radCtrl.Items.Add(
new
RadComboBoxItem(rowValue, rowValue));
radCtrl.SelectedIndex = 0;
After that i have the ItemsRequested event where i get all the possible values for each rcb. (in this case i only show exemple for one rcb)
protected
void
lstDentalGroup_ItemsRequested(
object
sender, RadComboBoxItemsRequestedEventArgs e)
{
ListItemsController ctrl =
new
ListItemsController();
lstDentalGroup.DataSource = ctrl.Select_Single_Column(
"Value1"
,
"DENTALGROUP"
);
lstDentalGroup.DataBind();
}
My problem is that when i press the SAVE button inside my form, the rcb.SelectedItem.Value will always be the first item I added by default in the Page_Load event, and not the one i select in the rcb.
Here is the HTML
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
Runat
=
"Server"
>
<
telerik:RadAjaxManagerProxy
ID
=
"radAjaxProxy_Calls"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"btnSave"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"mainContrainer"
LoadingPanelID
=
"radAjaxLoadingPanel"
UpdatePanelRenderMode
=
"inline"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManagerProxy
>
<
telerik:RadCodeBlock
ID
=
"radCodeBlockMain"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function OnDropDownHandler(sender, eventArgs) {
sender.requestItems("", false);
}
</
script
>
</
telerik:RadCodeBlock
>
<
asp:Panel
runat
=
"server"
ID
=
"mainContrainer"
style
=
"width:100%; height:100%; font-size:11px;"
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"lstDentalGroup"
Width
=
"92%"
Font-Size
=
"11px"
OnClientDropDownOpening
=
"OnDropDownHandler"
DataTextField
=
"CValue"
DataValueField
=
"CValue"
OnItemsRequested
=
"lstDentalGroup_ItemsRequested"
/>
<
asp:Button
runat
=
"server"
ID
=
"btnSave"
onclick
=
"btnSave_Click"
Text
=
"Save Combobox Value"
/>
</
asp:Panel
>
</
asp:Content
>
Here is the C#
public
partial
class
TestTelerik : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack) initialize_customerID(
"Boxer, Ken"
);
}
private
void
initialize_customerID(
string
customerID)
{
SQLGeneral ctrl =
new
SQLGeneral();
DataTable dt =
new
DataTable();
Hashtable hashFilter =
new
Hashtable();
hashFilter[
"CustomerID"
] = customerID;
hashFilter[
"Deleted"
] = 0;
dt = ctrl.GetDataTable(CustomersController.customer_details,
"Customers c LEFT JOIN ListItems li ON c.State = li.Value1"
, hashFilter);
if
(dt !=
null
)
{
// populate all the textBoxes & radComboBoxes in the form within one single for cycle -> save a lot fo production time.
for
(
int
i = 0; i <= dt.Columns.Count - 1; i++)
{
if
(dt.Columns[i].DataType ==
typeof
(System.String))
{
string
columnName = dt.Columns[i].ColumnName.ToString();
string
rowValue = dt.Rows[0][columnName].ToString().Trim();
// GET RADDROPDOWNBOXES
RadComboBox radCtrl =
this
.mainContrainer.FindControl(
"lst"
+ columnName)
as
RadComboBox;
if
(radCtrl !=
null
)
{
radCtrl.Items.Clear();
radCtrl.Items.Add(
new
RadComboBoxItem(rowValue, rowValue));
radCtrl.SelectedIndex = 0;
}
}
}
}
}
protected
void
lstDentalGroup_ItemsRequested(
object
sender, RadComboBoxItemsRequestedEventArgs e)
{
ListItemsController ctrl =
new
ListItemsController();
lstDentalGroup.DataSource = ctrl.Select_Single_Column(
"Value1"
,
"DENTALGROUP"
);
lstDentalGroup.DataBind();
}
protected
void
btnSave_Click(
object
sender, EventArgs e)
{
string
tmpSelValue = lstDentalGroup.SelectedItem.Value;
}
}
I know the rcb value are load on demand at the client side, but how i can make accessible form the server side, mentaining the LoadOnDemand functionality? The solution to get all the values on server side Page_Load event and bind them initially to all the rcb is not acceptable for me because of the amount of data to load from SQL
Thank you for your help