Hello,
On my Website i have two RadGrids. One for Servers and one for Products.
The ServerGrid got Columns like:
ID (PK)
CustomerID(FK)
Name
Location
IP
...
The ProductsGrid got Columns like:
ID (PK)
CustomerID(FK)
Name
Version
Server (based on the Column IP from ServerGrid)
...
Each Customer can have multiple Servers and Products. So when the Customer have 4 Servers and want to insert a new Product with "Add new Record" i have a FormTemplate with an DropDownList. All avaiable Servers(IP) for the customer are shown in this List. I fill this List in the ItemDatabound Event from the ProductsGrid:
Code from the DropDownList in the FormTemplate:
This works perfekt for inserting a new Product. But when i want to Edit an Product i can“t fill the DropDownList with the required Items before the SelectedValue are set wich cause an RunTimeError in JavaScript saying that the DropDownList got an invalid SelectedValue because it is not avaible in the ElementList.
So my question is, how can i set the Items for this DropdownList before the Grid want to set the SelectedValue?
Kind regards
Lukas
On my Website i have two RadGrids. One for Servers and one for Products.
The ServerGrid got Columns like:
ID (PK)
CustomerID(FK)
Name
Location
IP
...
The ProductsGrid got Columns like:
ID (PK)
CustomerID(FK)
Name
Version
Server (based on the Column IP from ServerGrid)
...
Each Customer can have multiple Servers and Products. So when the Customer have 4 Servers and want to insert a new Product with "Add new Record" i have a FormTemplate with an DropDownList. All avaiable Servers(IP) for the customer are shown in this List. I fill this List in the ItemDatabound Event from the ProductsGrid:
if
(e.Item
is
GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted)
{
GridEditableItem item = e.Item
as
GridEditableItem;
DropDownList ServerDDL = (DropDownList)item.FindControl(
"ddlServer"
);
// Code to filter and get all ServerIP avaible for this Customer
ServerDDL.Item.Add(Item);
}
Code from the DropDownList in the FormTemplate:
<
td
>
<
asp:DropDownList
ID
=
"ddlServer"
runat
=
"server"
SelectedValue='<%# Bind("Server") %>' TabIndex="5" AppendDataBoundItems="True">
<
asp:ListItem
Selected
=
"True"
Text
=
"Select"
Value
=
""
>
</
asp:ListItem
>
</
asp:DropDownList
>
</
td
>
This works perfekt for inserting a new Product. But when i want to Edit an Product i can“t fill the DropDownList with the required Items before the SelectedValue are set wich cause an RunTimeError in JavaScript saying that the DropDownList got an invalid SelectedValue because it is not avaible in the ElementList.
So my question is, how can i set the Items for this DropdownList before the Grid want to set the SelectedValue?
Kind regards
Lukas