All Im trying to do is pass a default value to the bound EDICustomerID feild so that when a new code is created via the radgrids 'add new record' it gets the value from the querystring Which holds the EDICustomerID that all codes belong to.
What is the cleanest / best practice way to get the default value to be a value from the querystring?
I tried the following but while it didn't throw an error, it didn't work, either:
ASPX:
objectDataSource(c#):
And finally the object its self:
What is the cleanest / best practice way to get the default value to be a value from the querystring?
I tried the following but while it didn't throw an error, it didn't work, either:
ASPX:
<
asp:ObjectDataSource
ID
=
"ods_EDICustomerCodes"
runat
=
"server"
SelectMethod
=
"SelectEDICustomerCode"
InsertMethod
=
"InsertEDICustomerCode"
UpdateMethod
=
"UpdateEDICustomerCode"
DeleteMethod
=
"DeleteEDICustomerCode"
TypeName
=
"App.BLLEDIIntegration.DS.EDICustomerCodeDS"
DataObjectTypeName
=
"App.BLLEDIIntegration.Models.EDICustomerCodeObj"
>
<
SelectParameters
>
<
asp:QueryStringParameter
DefaultValue
=
"0"
Name
=
"EDICustomerID"
QueryStringField
=
"EDICustomerID"
Type
=
"Int32"
/>
<
asp:Parameter
DefaultValue
=
"1"
Name
=
"active"
Type
=
"Int32"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
<
telerik:RadGrid
ID
=
"RadGrid1"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
OnItemInserted
=
"ItemInserted"
OnItemUpdated
=
"ItemUpdated"
OnItemDeleted
=
"ItemDeleted"
OnPreRender
=
"PreRender"
OnBatchEditCommand
=
"BatchEdit"
DataSourceID
=
"ods_EDICustomerCodes"
runat
=
"server"
AutoGenerateColumns
=
"False"
Skin
=
"Windows7"
GridLines
=
"Both"
AutoGenerateDeleteColumn
=
"True"
>
<
MasterTableView
CommandItemDisplay
=
"TopAndBottom"
EditMode
=
"Batch"
DataKeyNames
=
"EDICustomerCodeID"
OverrideDataSourceControlSorting
=
"true"
DataSourceID
=
"ods_EDICustomerCodes"
>
<
BatchEditingSettings
EditType
=
"Row"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"EDICustomerCodeID"
HeaderText
=
"EDICustomerCodeID"
UniqueName
=
"EDICustomerCodeID"
DataType
=
"System.Int32"
Display
=
"false"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"EDICustomerID"
DataType
=
"System.Int32"
HeaderText
=
"EDICustomerID"
UniqueName
=
"EDICustomerID"
Display
=
"False"
DefaultInsertValue='<%= Request["EDICustomerID"] %>'>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"EDICustomerCode"
HeaderText
=
"EDICustomerCode"
UniqueName
=
"EDICustomerCode"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Priority"
DataType
=
"System.Int32"
HeaderText
=
"Priority"
UniqueName
=
"Priority"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Active"
DataType
=
"System.Int32"
Display
=
"False"
HeaderText
=
"Active"
UniqueName
=
"Active"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
objectDataSource(c#):
namespace
App.BLLEDIIntegration.DS {
public
class
EDICustomerCodeDS {
// Select
public
List<EDICustomerCodeObj> SelectEDICustomerCode(
int
EDICustomerID,
int
active ) {
List<EDICustomerCodeObj> customerCodes = BLLData.RetrieveList<EDICustomerCodeObj>( t
rue
,
"EDIIntegration!GetEDICustomerCodes"
,
new
BLLParameterList(
"@EDICustomerID"
, EDICustomerID,
"@Active"
, active ) );
return
customerCodes;
}
// Insert
public
void
InsertEDICustomerCode(EDICustomerCodeObj cc){
BLLData.SaveData(
true
,
"EDIIntegration!AddCodeToEDICustomer"
,
new
BLLParameterList(
"@EDICustomerID"
, cc.EDICustomerID,
"@EDICustomerCode"
, cc.EDICustomerCode,
"@Priority"
, cc.Priority,
"@Active"
, 1
) );
}
// Update
public
void
UpdateEDICustomerCode(EDICustomerCodeObj cc) {
BLLData.SaveData(
true
,
"EDIIntegration!UpdateEDICustomerCode"
,
new
BLLParameterList(
"@EDICustomerCodeID"
, cc.EDICustomerCodeID,
"@EDICustomerID"
, cc.EDICustomerID,
"@EDICustomerCode"
, cc.EDICustomerCode,
"@Priority"
, cc.Priority,
"@Active"
, cc.Active
) );
}
// Delete
public
void
DeleteEDICustomerCode(EDICustomerCodeObj cc) {
BLLData.SaveData(
true
,
"EDIIntegration!DeactivateEDICustomerCode"
,
new
BLLParameterList(
"@EDICustomerCodeID"
, cc.EDICustomerCodeID ) );
}
}
}
And finally the object its self:
namespace
App.BLLEDIIntegration.Models {
[Serializable]
public
partial
class
EDICustomerCodeObj {
public
int
EDICustomerCodeID {
get
;
set
; }
public
int
EDICustomerID {
get
;
set
; }
public
string
EDICustomerCode {
get
;
set
; }
public
int
Priority {
get
;
set
; }
public
int
Active {
get
;
set
; }
}
}