or
I have a repeater control in which I hava 2 labels and a radcombo box. I am able to populate the labels and the radcombobox.
The way it should work is I need to map a label text to the value in the radcombo box . The problem is even though the value in the combo is selected it keeps reseting to the first item in the drop down list.
Can someone help me to keep the selected value of the radcombo box selected.See attached jpg.
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"MainContent"
runat
=
"server"
>
<
telerik:RadStyleSheetManager
ID
=
"RadStyleSheetManager1"
runat
=
"server"
>
</
telerik:RadStyleSheetManager
>
<
h2
>Server Request Dynamic Reports Creation</
h2
>
<
p
>
<
telerik:RadScriptManager
ID
=
"rsmDynamicReports"
Runat
=
"server"
>
</
telerik:RadScriptManager
> </
p
>
<
telerik:RadAjaxPanel
ID
=
"RadDynamicRpt"
runat
=
"server"
HorizontalAlign
=
"NotSet"
>
<
table
id
=
"telerikTable"
>
<
tr
valign
=
"top"
>
<
td
> <
asp:Label
ID
=
"lblRptServer"
runat
=
"server"
Text
=
"Report Server :"
Font-Size
=
"Small"
></
asp:Label
></
td
>
<
td
colspan
=
"2"
> <
asp:DropDownList
ID
=
"ddlDynamicRpt"
runat
=
"server"
AutoPostBack
=
"True"
ForeColor
=
"#3366FF"
Font-Size
=
"Small"
>
<
asp:ListItem
Value
=
"0"
>--Select One--</
asp:ListItem
> </
asp:DropDownList
></
td
>
</
tr
>
<
tr
valign
=
"top"
>
<
td
colspan
=
"3"
><
asp:Label
ID
=
"lblReportName"
runat
=
"server"
Text
=
"Select Report :"
Font-Size
=
"Small"
></
asp:Label
></
td
>
</
tr
>
<
tr
valign
=
"top"
>
<
td
></
td
>
<
td
colspan
=
"2"
>
<
div
style
=
"width: 396px"
>
<
asp:Panel
ID
=
"panel1"
Width
=
"400px"
BorderStyle
=
"Solid"
BorderWidth
=
"1pt"
ScrollBars
=
"Vertical"
runat
=
"server"
>
<
asp:TreeView
ID
=
"tvCatalog"
runat
=
"server"
AutoGenerateDataBindings
=
"true"
BorderStyle
=
"none"
Height
=
"100px"
Font-Size
=
"Small"
>
</
asp:TreeView
>
</
asp:Panel
>
</
div
></
td
>
</
tr
>
<
tr
valign
=
"top"
>
<
td
><
asp:Label
ID
=
"label1"
runat
=
"server"
Text
=
"Report Path :"
Font-Size
=
"Small"
></
asp:Label
></
td
>
<
td
colspan
=
"2"
><
telerik:RadTextBox
ID
=
"RadPath"
runat
=
"server"
Width
=
398px
ForeColor
=
"#3366FF"
BorderStyle
=
"Solid"
BorderWidth
=
"1pt"
Enabled
=
"False"
Font-Size
=
"Small"
></
telerik:RadTextBox
></
td
>
</
tr
>
<
tr
valign
=
"top"
>
<
td
></
td
>
<
td
colspan
=
"2"
>
<
table
>
<
asp:Repeater
ID
=
"rptFields"
runat
=
"server"
>
<
HeaderTemplate
>
<
tr
>
<
td
width
=
"150px"
>
<
asp:Label
ID
=
"lblReportParam"
runat
=
"server"
ForeColor
=
"Blue"
Text
=
"Report Parameter"
Font-Bold
=
"true"
></
asp:Label
>
</
td
>
<
td
>
<
asp:Label
ID
=
"lblServeRequest"
runat
=
"server"
ForeColor
=
"Blue"
Text
=
"Server Request Field"
Font-Bold
=
"true"
></
asp:Label
>
</
td
>
</
tr
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"lblReportParamField"
runat
=
"server"
Text='<%# Bind("RptParam") %>'></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"rcbServerRequest"
runat
=
"server"
OnItemDataBound
=
"rptFields_ItemDataBound"
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
</
ItemTemplate
>
</
asp:Repeater
>
</
table
>
</
td
>
</
tr
>
<
tr
valign
=
"top"
>
<
td
> </
td
>
<
td
colspan
=
"2"
>
<
asp:Button
ID
=
"btnrpt"
runat
=
"server"
Text
=
"Submit"
/></
td
>
</
tr
>
</
table
>
</
telerik:RadAjaxPanel
>
</
asp:Content
>
function OnClientHiding(sender, args) {
__doPostBack('<%=btnCloseMessage.ClientID %>', 'OnClick');
}
<
asp:UpdatePanel
ID
=
"Message"
runat
=
"server"
ChildrenAsTriggers
=
"True"
UpdateMode
=
"Conditional"
Visible
=
"True"
>
<
Triggers
>
<
asp:AsyncPostBackTrigger
ControlID
=
"btnCloseMessage"
EventName
=
"Click"
/>
</
Triggers
>
<
ContentTemplate
>
<
div
style
=
"visibility: hidden; height: 1px; width: 1px; overflow: hidden"
>
<
telerik:RadButton
ID
=
"btnCloseMessage"
runat
=
"server"
OnClick
=
"btnCloseMessage_Click"
CausesValidation
=
"False"
>
</
telerik:RadButton
>
</
div
>
<
telerik:RadNotification
ID
=
"RadNotification1"
runat
=
"server"
Skin
=
"Black"
AutoCloseDelay
=
"0"
VisibleOnPageLoad
=
"False"
Width
=
"300"
Animation
=
"Fade"
EnableRoundedCorners
=
"true"
OnClientHiding
=
"OnClientHiding"
EnableShadow
=
"true"
Title
=
"Breaking News"
OffsetX
=
"-20"
OffsetY
=
"-20"
>
<
ContentTemplate
>
<
asp:Literal
ID
=
"litMessage"
runat
=
"server"
></
asp:Literal
>
</
ContentTemplate
>
</
telerik:RadNotification
>
<
asp:Timer
ID
=
"Timer1"
runat
=
"server"
Interval
=
"1000"
OnTick
=
"Timer1_Tick"
>
</
asp:Timer
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
<
asp:Panel
runat
=
"server"
ID
=
"DockPanel"
>
<
telerik:RadDock
runat
=
"server"
ID
=
"RadDock1"
Width
=
"445px"
Height
=
"410px"
Closed
=
"true"
Style
=
"z-index: 2000;"
Title
=
"Group Training Class"
OnClientDockPositionChanged
=
"dockMoved"
>
<
Commands
>
<
telerik:DockCloseCommand
/>
</
Commands
>
<
ContentTemplate
>
<
div
class
=
"editForm"
>
<
div
class
=
"content"
>
<
table
border
=
"0"
cellpadding
=
"2"
cellspacing
=
"5"
>
<
tr
><
td
></
td
><
td
></
td
></
tr
>
<
tr
><
td
></
td
><
td
></
td
></
tr
>
<
tr
>
<
td
align
=
"right"
style
=
"padding:3px 0px 0px 0px;"
>
<
asp:Label
ID
=
"label1"
runat
=
"server"
>Description:</
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"description"
runat
=
"server"
TextMode
=
"MultiLine"
Rows
=
"2"
Columns
=
"50"
ReadOnly
=
"true"
Style
=
"padding:5px;"
></
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"right"
style
=
"padding:3px 0px 0px 0px;"
>
<
asp:Label
ID
=
"label2"
runat
=
"server"
>Date:</
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"date"
runat
=
"server"
ReadOnly
=
"true"
style
=
"padding:2px;"
></
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"right"
style
=
"padding:3px 0px 0px 0px;"
>
<
asp:Label
ID
=
"label3"
runat
=
"server"
>Start Time:</
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"start_time"
runat
=
"server"
ReadOnly
=
"true"
style
=
"padding:2px;"
></
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"right"
style
=
"padding:3px 0px 0px 0px;"
>
<
asp:Label
ID
=
"label4"
runat
=
"server"
>End Time:</
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"end_time"
runat
=
"server"
ReadOnly
=
"true"
style
=
"padding:2px;"
></
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"right"
style
=
"padding:3px 0px 0px 0px;"
>
<
asp:Label
ID
=
"label5"
runat
=
"server"
style
=
"padding:2px;"
>Personal Trainer:</
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"personal_trainer"
runat
=
"server"
ReadOnly
=
"true"
style
=
"padding:2px;"
></
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
style
=
"display:none;"
>
<
td
align
=
"right"
>
<
asp:Label
ID
=
"label7"
runat
=
"server"
>Registered Members:</
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"registered_members"
runat
=
"server"
TextMode
=
"MultiLine"
Rows
=
"2"
Columns
=
"50"
ReadOnly
=
"true"
></
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
style
=
"display:none;"
>
<
td
align
=
"right"
>
<
asp:Label
ID
=
"label8"
runat
=
"server"
>Wait List Members:</
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"wait_members"
runat
=
"server"
TextMode
=
"MultiLine"
Rows
=
"2"
Columns
=
"50"
ReadOnly
=
"true"
></
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
style
=
"display:none;"
>
<
td
align
=
"right"
>
<
asp:Label
ID
=
"label9"
runat
=
"server"
>Date (mm/dd/yyyy format):</
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"date_mmddyyyy"
runat
=
"server"
ReadOnly
=
"true"
></
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
style
=
"display:none;"
>
<
td
align
=
"right"
>
<
asp:Label
ID
=
"label10"
runat
=
"server"
>Start Time (hh:mm format):</
asp:Label
>
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"start_time_hhmm"
runat
=
"server"
ReadOnly
=
"true"
></
telerik:RadTextBox
>
</
td
>
</
tr
>
</
table
>
<
br
/>
<
span
style
=
"padding:0px 145px 0px 3px;"
>Not Registered</
span
><
span
>Registered</
span
>
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
style
=
"padding: 2px 0px 0px 3px;"
>
<
telerik:RadListBox
ID
=
"members_not_assigned"
runat
=
"server"
Width
=
"225px"
Height
=
"100px"
SelectionMode
=
"Single"
AllowTransfer
=
"true"
TransferToID
=
"members_assigned"
AutoPostBackOnTransfer
=
"false"
AllowReorder
=
"false"
AutoPostBackOnReorder
=
"false"
EnableDragAndDrop
=
"true"
ButtonSettings-ShowTransferAll
=
"false"
OnClientTransferring
=
"TransferringListBoxItem"
>
</
telerik:RadListBox
>
<
telerik:RadListBox
ID
=
"members_assigned"
runat
=
"server"
Width
=
"195px"
Height
=
"100px"
SelectionMode
=
"Single"
AllowReorder
=
"false"
AutoPostBackOnReorder
=
"true"
EnableDragAndDrop
=
"true"
>
</
telerik:RadListBox
>
</
telerik:RadAjaxPanel
>
<
label
style
=
"padding: 0px 0px 0px 3px; font-size:smaller"
>* Member name followed by an asterisk indicates member is on the wait list</
label
>
</
div
>
<
br
/>
<
div
>
<
input
type
=
"checkbox"
id
=
"agree"
onclick
=
"UpdateSubmitButton()"
/>I understand the terms and conditions listed
<
a
href
=
"TermsAndConditions.aspx"
target
=
"_blank"
> here</
a
>.
</
div
>
<
br
/>
<
div
class
=
"footer"
>
<
button
id
=
"submit"
onclick
=
"UpdateAppointment()"
type
=
"button"
disabled
=
"disabled"
>Submit</
button
>
<
button
onclick
=
"hideForm();"
type
=
"button"
>Cancel</
button
>
</
div
>
</
div
>
</
ContentTemplate
>
</
telerik:RadDock
>
</
asp:Panel
>
Good afternoon,
I have code in my aspx page:
<telerik:RadComboBox ID="ddlSuperintendent" runat="server" Width="170px" AllowCustomText="false" >
</telerik:RadComboBox>
private
void
createGrid()
{
RadGrid grid =
new
RadGrid();
this
.rgWorkflows = grid;
setGridProperties(grid);
}
private
void
setGridProperties(RadGrid grid)
{
grid.ID =
"rgWorkflows"
;
grid.EnableViewState =
true
;
grid.AutoGenerateColumns =
false
;
grid.AllowSorting =
true
;
grid.AllowPaging =
true
;
grid.AllowFilteringByColumn =
false
;
grid.GridLines = GridLines.None;
grid.Width = Unit.Percentage(99.8);
grid.Height = Unit.Percentage(99.8);
grid.HeaderStyle.Width = Unit.Pixel(150);
grid.AllowMultiRowSelection =
true
;
grid.MasterTableView.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced;
grid.ClientSettings.EnableRowHoverStyle =
true
;
grid.ClientSettings.Selecting.AllowRowSelect =
true
;
grid.ClientSettings.Scrolling.AllowScroll =
true
;
grid.ClientSettings.Scrolling.UseStaticHeaders =
true
;
grid.ClientSettings.Scrolling.SaveScrollPosition =
true
;
grid.ClientSettings.Resizing.AllowColumnResize =
true
;
grid.ClientSettings.Resizing.ClipCellContentOnResize =
false
;
grid.ClientSettings.Resizing.EnableRealTimeResize =
true
;
grid.ClientSettings.Resizing.ResizeGridOnColumnResize =
true
;
grid.MasterTableView.DataKeyNames =
new
string
[] {
"Id"
};
grid.MasterTableView.OverrideDataSourceControlSorting =
true
;
grid.PagerStyle.AlwaysVisible =
true
;
if
(!IsPostBack)
{
grid.MasterTableView.PageSize = 15;
}
grid.GroupingSettings.CaseSensitive =
false
;
grid.MasterTableView.PagerStyle.Width = 1000;
grid.MasterTableView.OverrideDataSourceControlSorting =
true
;
grid.MasterTableView.EnableColumnsViewState =
false
;
grid.AllowFilteringByColumn =
true
;
grid.AllowMultiRowSelection =
false
;
}
public
static
void
AddDateTimeFieldToGridView(
string
fieldName,
string
headerText, RadGrid grid,
int
? width)
{
GridDateTimeColumn dtc =
new
GridDateTimeColumn()
{
HeaderText = headerText,
DataField = fieldName
};
dtc.SortExpression = fieldName.Trim();
dtc.AllowSorting =
true
;
dtc.Resizable =
true
;
dtc.UniqueName = fieldName;
dtc.DataFormatString =
"{0:dd.MM.yyyy}"
;
dtc.PickerType = GridDateTimeColumnPickerType.DateTimePicker;
dtc.UniqueName = fieldName;
if
(width !=
null
)
{
dtc.HeaderStyle.Width = width.Value;
}
grid.Columns.Add(dtc);
}
private
static
void
setDateFilterPattern(GridCommandEventArgs e, RadGrid grid,
string
fieldName,
string
columnUniqueName)
{
if
(e.CommandName == RadGrid.FilterCommandName
&& ((Pair)e.CommandArgument).Second.ToString() == columnUniqueName
&& ((Pair)e.CommandArgument).First.ToString() !=
"NoFilter"
&& grid !=
null
)
{
e.Canceled =
true
;
GridFilteringItem filterItem = (GridFilteringItem)e.Item;
string
currentPattern = (filterItem[((Pair)e.CommandArgument).Second.ToString()].Controls[0]
as
RadDatePicker).SelectedDate.Value.ToShortDateString();
string
filterPattern =
""
;
string
filterOption = (e.CommandArgument
as
Pair).First.ToString();
GridBoundColumn dateColumn = (GridBoundColumn)e.Item.OwnerTableView.GetColumnSafe(columnUniqueName);
filterPattern = currentPattern;
switch
(filterOption)
{
case
"EqualTo"
:
var dateTime = Convert.ToDateTime(filterPattern);
filterPattern = String.Format(
"["
+ fieldName +
"] > '{0}' AND ["
+ fieldName +
"] < '{1}'"
, filterPattern,
dateTime.AddDays(1).ToShortDateString());
dateColumn.CurrentFilterFunction = GridKnownFunction.EqualTo;
break
;
case
"NotEqualTo"
:
var dateTime1 = Convert.ToDateTime(filterPattern);
filterPattern = String.Format(
"["
+ fieldName +
"] < '{0}' OR ["
+ fieldName +
"] > '{1}'"
, filterPattern,
dateTime1.AddDays(1).ToShortDateString());
dateColumn.CurrentFilterFunction = GridKnownFunction.NotEqualTo;
break
;
case
"GreaterThan"
:
filterPattern =
"["
+ fieldName +
"] > '"
+ filterPattern +
"'"
;
dateColumn.CurrentFilterFunction = GridKnownFunction.GreaterThan;
break
;
case
"LessThan"
:
filterPattern =
"["
+ fieldName +
"] < '"
+ filterPattern +
"'"
;
dateColumn.CurrentFilterFunction = GridKnownFunction.LessThan;
break
;
case
"GreaterThanOrEqualTo"
:
var dateTime2 = Convert.ToDateTime(filterPattern);
filterPattern = String.Format(
"["
+ fieldName +
"] > '{0}' AND ["
+ fieldName +
"] < '{1}' OR ["
+ fieldName +
"] >= '{0}'"
,
filterPattern, dateTime2.AddDays(1).ToShortDateString());
dateColumn.CurrentFilterFunction = GridKnownFunction.GreaterThanOrEqualTo;
break
;
case
"LessThanOrEqualTo"
:
var dateTime3 = Convert.ToDateTime(filterPattern);
filterPattern = String.Format(
"["
+ fieldName +
"] > '{0}' AND ["
+ fieldName +
"] < '{1}' OR ["
+ fieldName +
"] <= '{0}'"
,
filterPattern, dateTime3.AddDays(1).ToShortDateString());
dateColumn.CurrentFilterFunction = GridKnownFunction.GreaterThanOrEqualTo;
break
;
case
"IsNull"
:
filterPattern =
"["
+ fieldName +
"] IS NULL"
;
dateColumn.CurrentFilterFunction = GridKnownFunction.IsNull;
break
;
case
"NotIsNull"
:
filterPattern =
"NOT (["
+ fieldName +
"] IS NULL)"
;
dateColumn.CurrentFilterFunction = GridKnownFunction.NotIsNull;
break
;
}
foreach
(GridColumn column
in
grid.MasterTableView.Columns)
{
if
(column.UniqueName != columnUniqueName)
{
column.CurrentFilterFunction = GridKnownFunction.NoFilter;
column.CurrentFilterValue =
string
.Empty;
}
}
dateColumn.CurrentFilterValue = currentPattern;
grid.MasterTableView.FilterExpression = filterPattern;
filterItem.OwnerTableView.Rebind();
}
}