Hello guys,
My problem is kind complicated, i'm trying to pass a DataSource to an RadComboBox (List<> provided by wcf service)
my problem is, i'm using the automated Insert button from the radgrid and it pop's up the Add new window
Follow the front end code
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
OnInsertCommand
=
"RadGrid1_InsertCommand"
OnUpdateCommand
=
"RadGrid1_UpdateCommand"
ExportSettings-Word-Format
=
"Docx"
AllowAutomaticDeletes
=
"true"
OnDeleteCommand
=
"RadGrid1_DeleteCommand"
GroupPanelPosition
=
"Top"
AutoGenerateDeleteColumn
=
"True"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
ShowFooter
=
"True"
ShowGroupPanel
=
"True"
ShowStatusBar
=
"True"
Height
=
"543px"
ClientSettings-Scrolling-AllowScroll
=
"true"
AutoGenerateColumns
=
"False"
AutoGenerateEditColumn
=
"True"
>
<
GroupingSettings
CollapseAllTooltip
=
"Collapse all groups"
/>
<
ExportSettings
>
<
Word
Format
=
"Docx"
/>
</
ExportSettings
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"True"
/>
<
Selecting
AllowRowSelect
=
"true"
EnableDragToSelectRows
=
"true"
/>
</
ClientSettings
>
<
MasterTableView
AutoGenerateColumns
=
"false"
DataKeyNames
=
"ID"
CommandItemDisplay
=
"top"
EditMode
=
"PopUp"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ProductID"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter ProductID column"
HeaderText
=
"ProductID"
SortExpression
=
"ProductID"
UniqueName
=
"ProductID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ID"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter ID column"
HeaderText
=
"ID"
SortExpression
=
"ID"
UniqueName
=
"ID"
ReadOnly
=
"True"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Quantity"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter Quantity column"
HeaderText
=
"Quantity"
SortExpression
=
"Quantity"
UniqueName
=
"Quantity"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"EditDate"
DataType
=
"System.DateTime"
FilterControlAltText
=
"Filter EditDate column"
HeaderText
=
"EditDate"
SortExpression
=
"EditDate"
UniqueName
=
"EditDate"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ProductName"
FilterControlAltText
=
"Filter Product column"
HeaderText
=
"Product"
SortExpression
=
"ProductName"
UniqueName
=
"ProductName"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
Product:
<
telerik:RadComboBox
ID
=
"ddProductStock"
Runat
=
"server"
AllowCustomText
=
"True"
DataTextField
=
"Product"
DataValueField
=
"ID"
Filter
=
"Contains"
MarkFirstMatch
=
"True"
SelectedValue='<%# Bind("ProductID") %>' >
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
runat
=
"server"
ControlToValidate
=
"ddProductStock"
ErrorMessage
=
"*Product cannot be empty!"
Font-Bold
=
"True"
ForeColor
=
"Red"
></
asp:RequiredFieldValidator
>
<
br
/>
Quantity:
<
telerik:RadNumericTextBox
ID
=
"txtQuantityAdd"
Runat
=
"server"
LabelWidth
=
"64px"
Resize
=
"None"
Text='<%# Bind("Quantity", "{0:N}") %>' Width="160px" EmptyMessage="Type The Quantity" MinValue="0" MaxValue="99999999">
<
NumberFormat
GroupSeparator
=
""
DecimalDigits
=
"0"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator2"
runat
=
"server"
ControlToValidate
=
"txtQuantityAdd"
ErrorMessage
=
"*Quantity cannot be empty!!"
Font-Bold
=
"True"
ForeColor
=
"Red"
></
asp:RequiredFieldValidator
>
<
asp:SqlDataSource
ID
=
"SqlDataSource2"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:FinancialConnectionString %>" SelectCommand="SELECT [ID], [Product], [Description] FROM [AssetsProd]"></
asp:SqlDataSource
>
<
telerik:RadButton
ID
=
"btnUpdate"
runat
=
"server"
CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' >
<
Icon
PrimaryIconCssClass
=
"rbAdd"
/>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"btnCancel"
Text
=
"Cancel"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
>
<
Icon
PrimaryIconCssClass
=
"rbCancel"
/>
</
telerik:RadButton
>
</
FormTemplate
>
</
EditFormSettings
>
<
CommandItemSettings
AddNewRecordText
=
"Add Stock"
AddNewRecordImageUrl
=
"Resources/add-text-file.png"
ShowExportToWordButton
=
"true"
ExportToCsvImageUrl
=
"Resources/excel-fil.png"
ExportToPdfImageUrl
=
"Resources/pdf-file-format-symbol.png"
ExportToWordImageUrl
=
"Resources/docx-file-variant.png"
ShowExportToCsvButton
=
"true"
ShowExportToPdfButton
=
"true"
/>
</
MasterTableView
>
<
FilterItemStyle
BackColor
=
"#00CC66"
/>
</
telerik:RadGrid
>
this is an old code witch i;m updating to work on an API witch dont allow direct SQL connection, it must be provided by web service (the List<>)
But, i need to provide this DataSource to this RadComboBox when the Add new button is pressed to load the list of registered products.
I'm not able to do this right know
i already did to the radgrid1,
protected
void
RadGrid1_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
List<ServiceReference2.Stock> NewStock =
new
List<ServiceReference2.Stock>();
NewStock = objServiceClientObjClient.SelectStock().ToList();
RadGrid1.DataSource = NewStock;
}i tried so many things that i found here, but no one was far close to my problem.
thank you