<
ul
>
<
li
>
<
em
>Out-of-the-box XHTML-enabled Output...</
em
>
</
li
>
<
li
>
<
em
>Unmatched Loading Speed and Performance</
em
>
</
li
>
<
li
>
<
em
>Microsoft Word-like Spell-checking</
em
>
</
li
>
<
li
>
<
em
>Seven Ways for Pasting from Word</
em
>
</
li
>
<
li
>
<
em
>Multilevel Undo/Redo with Action Trails</
em
>
</
li
>
<
li
>
<
em
>Extended Functionality Through Integrated Controls</
em
>
</
li
>
</
ul
>
<
ul
>
<
li
>
<
em
><
span
></
span
></
em
></
li
>
<
span
>Out-of-the-box XHTML-enabled Output...
Unmatched Loading Speed and Performance
Microsoft Word-like Spell-checking
Seven Ways for Pasting from Word
Multilevel Undo/Redo with Action Trails
Extended Functionality Through Integrated Controls</
span
>
<
li
><
em
></
em
>
</
li
>
</
ul
>
Well, I have seen similar problems and corresponding solutions on the forums, but none of those was applicable for this problem. I already have tried and searched almost any given solution on the forums here and around the internet, but unfortunately to no avail.
So, what exactly is the problem? I have got a RadComboBox which has an ObjectDataSource. This ComboBox has been placed in an EditItemTemplate within a RadListView. I want this RadComboBox to display the name of the currently selected customer as SelectedIndex (SelectedValue or Text). Items are filled based upon data out of an XmlDataSource object. The ObjectDataSource contains all possible customers.
Let's say I have inserted a new item with customer: "Customer1", but I'd like to edit this item. When you go into the EditItemTemplate view, I want to have the RadComboBox select (SelectedIndex/Value or Text) "Customer1" (which is based upon the XmlDataSource) from the ObjectDataSource.
My RadComboBox and ObjectDataSource look like:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
AllowCustomText
=
"false"
DataSourceID
=
"ObjectDataSource1"
DataTextField
=
"Name"
DataValueField
=
"Name"
DropDownWidth
=
"128px"
EmptyMessage
=
"-Customer-"
EnableAutomaticLoadOnDemand
=
"true"
EnableVirtualScrolling
=
"true"
Filter
=
"Contains"
Height
=
"150px"
ItemsPerRequest
=
"10"
MarkFirstMatch
=
"true"
MinFilterLength
=
"2"
ShowMoreResultsBox
=
"true"
Width
=
"128px"
>
</
telerik:RadComboBox
>
<
asp:ObjectDataSource
ID
=
"ObjectDataSource1"
runat
=
"server"
SelectMethod
=
"GetCustomers"
TypeName
=
"RadControlsWebApp1.Customers"
>
</
asp:ObjectDataSource
>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
Activities
>
<
Activity
Customer
=
"Customer1"
Project
=
"Project1"
/>
<
Activity
Customer
=
"Customer1"
Project
=
"Project2"
/>
<
Activity
Customer
=
"Customer2"
Project
=
"Project2"
/>
<
Activity
Customer
=
"Customer3"
Project
=
"Project3"
/>
</
Activities
>
<
head
runat
=
"server"
>
<
title
>Untitled</
title
>
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"styles.css"
/>
</
head
>
<
body
>
<
form
id
=
"mainForm"
runat
=
"server"
>
<
telerik:RadScriptManager
runat
=
server
ID
=
"ScriptManager"
></
telerik:RadScriptManager
>
<
div
>
<
telerik:RadTabStrip
ID
=
"RadTabStrip1"
runat
=
"server"
SelectedIndex
=
"0"
Skin
=
"Vista"
ScrollChildren
=
"true"
ScrollButtonsPosition
=
"Middle"
Orientation
=
"HorizontalTop"
>
<
TabTemplate
>
<
div
class
=
"textWrapper"
>
<%# DataBinder.Eval(Container, "Text") %>
</
div
>
<
span
class
=
"ie6shim"
></
span
>
<
img
src
=
"Images/Close.gif"
alt
=
"Close"
onclick
=
"deleteTab('<%# DataBinder.Eval(Container, "
Text") %>')" />
<
TabTemplate
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Selected
=
"True"
Text
=
"Tab1"
></
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab2"
></
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab3"
></
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
</
div
>
</
form
>
</
body
>
This is the styles.css file:
.tabStrip
{
position:absolute;
top:0;
}
.rtsIn img
{
vertical-align:middle;
width: 14px;
height: 14px;
margin-left: 10px;
}
.rtsIn .textWrapper
{
display: inline;
}
/* IE6 fixes for line-height bug */
* html .rtsIn img
{
margin-bottom: 10px;
}
* html .rtsIn .textWrapper
{
float: left;
height:26px;
}
* html .rtsIn .ie6shim
{
height: 26px;
display: inline-block;
}
<
asp:Repeater
ID
=
"rptMarkets"
runat
=
"server"
DataSourceID
=
"objMarkets"
>
<
ItemTemplate
>
<
b
>
<%#DataBinder.Eval(Container.DataItem, "Market")%></
b
>
<!-- Nested Repeater Level 2 - START -->
<
asp:HiddenField
ID
=
"HiddenField1"
runat
=
"server"
Value='<%# Eval("MarketID") %>' />
<
asp:ObjectDataSource
ID
=
"objProducts"
runat
=
"server"
SelectMethod
=
"GetProductsByMarketsID"
TypeName
=
"Ceradyne.clsLibrary"
>
<
SelectParameters
>
<
asp:ControlParameter
Name
=
"MarketID"
Type
=
"Int32"
ControlID
=
"HiddenField1"
PropertyName
=
"Value"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
<
ul
>
<
asp:CheckBoxList
ID
=
"clProductName"
runat
=
"server"
DataSourceID
=
"objProducts"
DataTextField
=
"ProductName"
DataValueField
=
"ProductID"
RepeatColumns
=
"3"
Font-Size
=
"8px"
>
</
asp:CheckBoxList
>
</
ul
>
<!-- Nested Repeater Level 2 - END -->
</
ItemTemplate
>
<
SeparatorTemplate
>
<
hr
/>
</
SeparatorTemplate
>
</
asp:Repeater
>
Protected Sub RadGrid1_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand
'save the file to the website
Dim txtPDFFile As String = ""
Dim Upload As RadUpload = TryCast(e.Item.FindControl("upBrochurePDF"), RadUpload)
Dim BrochureFolder As String = Server.MapPath("~/uploads/brochures/")
If Upload.UploadedFiles.Count > 0 Then
For Each file As UploadedFile In Upload.UploadedFiles
txtPDFFile = file.GetName()
file.SaveAs(BrochureFolder & txtPDFFile, True)
Next
End If
'check to see if this file name exists already
'(not written yet)
' save the file name to the database
objBrochure.AddBrochure(txtPDFFile)
'look up the brochure id based on the filename
objBrochure.GetBrochuresByFilename(txtPDFFile)
Dim BrochureID As Integer = objBrochure.BrochureID
'save the value of the check boxes
Dim ProductID As Integer
Dim i As Integer
Dim List As CheckBoxList = DirectCast(e.Item.FindControl("clProductName"), CheckBoxList)
For i = 0 To List.Items.Count - 1
If List.Items(i).Selected = "true" Then
ProductID = List.Items(i).Value
'add brochure links to products
objBrochure.AddBrochureProductLink(BrochureID, ProductID)
End If
Next
Response.Redirect("/admin/Library/ManageBrochures.aspx")
End Sub