I want to edit a row in the grid by opening a popup.
I am able to open a editable popup window on click of edit button in the grid by calling a java script function in ItemDataBound event at server side. When i open the popup using window.radopen(), i am able to pass grid row data as arguments of radopen(). But in the pop up, page_load is not getting called and hence i am not able to catch the query string values. As a result i am unable to edit the row.
Please advise. Find the code below.
aspx code
--------------
I am able to open a editable popup window on click of edit button in the grid by calling a java script function in ItemDataBound event at server side. When i open the popup using window.radopen(), i am able to pass grid row data as arguments of radopen(). But in the pop up, page_load is not getting called and hence i am not able to catch the query string values. As a result i am unable to edit the row.
Please advise. Find the code below.
aspx code
--------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManageOverrides.aspx.cs"
Inherits="AdminWebsite.ManageOverrides" MasterPageFile="~/Admin.Master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"server"
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function ShowEditForm(EntityID, EntityType, MaintenanceLong, MaintenanceShort, InitialLong, InitialShort, DayTradeLong, DayTradeShort) {
window.radopen("ManageOverridesEdit.aspx?EntityID=" + EntityID + "&EntityType=" + EntityType + "&MaintenanceLong=" + MaintenanceLong + "&MaintenanceShort=" + MaintenanceShort + "&InitialLong=" + InitialLong + "&InitialShort=" + InitialShort + "&DayTradeLong=" + DayTradeLong + "&DayTradeShort=" + DayTradeShort, "ManageOverridesEdit");
}
</
script
>
</
telerik:RadCodeBlock
>
<
telerik:radwindowmanager
id
=
"RadWindowManager2"
runat
=
"server"
enableshadow
=
"true"
skin
=
"Office2007"
initialbehavior
=
"Close"
behavior
=
"Close,Move"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"ManageOverridesEdit1"
runat
=
"server"
Title
=
"Manage Overrides Edit"
Skin
=
"Office2007"
Height
=
"500px"
Width
=
"800px"
Left
=
"100px"
ReloadOnShow
=
"false"
VisibleStatusbar
=
"true"
ShowContentDuringLoad
=
"true"
Modal
=
"true"
Behavior
=
"Minimize,Maximize,Close,Move"
/>
</
Windows
>
</
telerik:radwindowmanager
>
<
asp:Panel
ID
=
"pnlSecuritySearchResults"
runat
=
"server"
Width
=
"60%"
Visible
=
"false"
>
<
telerik:RadGrid
ID
=
"rgSecuritySearchResults"
runat
=
"server"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
Skin
=
"Office2007"
AllowPaging
=
"True"
OnItemDataBound
=
"rgSecuritySearchResults_ItemDataBound"
DataSourceID
=
"SecurityOverridesDS"
OnDeleteCommand
=
"rgSecuritySearchResults_ItemCommand"
>
<
MasterTableView
DataSourceID
=
"SecurityOverridesDS"
DataKeyNames
=
"EntityID,EntityType,CUSIP"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridTemplateColumn
DataField
=
"Action"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Action"
UniqueName
=
"Action"
>
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Center"
/>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"ImgDelete"
ToolTip
=
"Click here to Delete"
CommandName
=
"Delete"
runat
=
"server"
Text
=
"Delete"
ImageUrl
=
"images/Delete.gif"
OnClientClick
=
"if (!confirm('Are You sure you want to delete the selected security override ?')) return false;"
/>
<
asp:ImageButton
ID
=
"imgBtnEdit"
ImageUrl
=
"images/radgrid/Edit.gif"
ToolTip
=
"Click here to Edit"
Text
=
"Edit"
runat
=
"server"
CommandName
=
"Edit"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Entity ID"
UniqueName
=
"EntityID"
DataField
=
"EntityID"
SortExpression
=
"EntityID"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblEntityID"
Text='<%# DataBinder.Eval(Container.DataItem, "EntityID")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Entity Type"
UniqueName
=
"EntityType"
DataField
=
"EntityType"
SortExpression
=
"Symbol"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblEntityType"
Text='<%# DataBinder.Eval(Container.DataItem, "EntityType")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Symbol"
UniqueName
=
"Symbol"
DataField
=
"Symbol"
SortExpression
=
"Symbol"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Correspondent Code"
UniqueName
=
"CorrespondentCode"
DataField
=
"CorrespondentID"
SortExpression
=
"CorrespondentCode"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Office Code"
UniqueName
=
"OfficeCode"
DataField
=
"OfficeID"
SortExpression
=
"OfficeCode"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Rep ID"
UniqueName
=
"RepID"
DataField
=
"RepID"
SortExpression
=
"RepID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Account Number"
UniqueName
=
"AccountNumber"
DataField
=
"AccountNumber"
SortExpression
=
"AccountNumber"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Maintenance Long"
UniqueName
=
"MaintenanceLong"
DataField
=
"MaintenanceLong"
SortExpression
=
"MaintenanceLong"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblMaintenanceLong"
Text='<%# DataBinder.Eval(Container.DataItem, "MaintenanceLong")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Maintenance Short"
UniqueName
=
"MaintenanceShort"
DataField
=
"MaintenanceShort"
SortExpression
=
"MaintenanceShort"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblMaintenanceShort"
Text='<%# DataBinder.Eval(Container.DataItem, "MaintenanceShort")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Initial Long"
UniqueName
=
"InitialLong"
DataField
=
"InitialLong"
SortExpression
=
"InitialLong"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblInitialLong"
Text='<%# DataBinder.Eval(Container.DataItem, "InitialLong")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Initial Short"
UniqueName
=
"InitialShort"
DataField
=
"InitialShort"
SortExpression
=
"InitialShort"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblInitialShort"
Text='<%# DataBinder.Eval(Container.DataItem, "InitialShort")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Day Trade Long"
UniqueName
=
"OldMaintenanceLong"
DataField
=
"OldMaintenanceLong"
SortExpression
=
"OldMaintenanceLong"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblDayTradeLong"
Text='<%# DataBinder.Eval(Container.DataItem, "OldMaintenanceLong")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Day Trade Short"
UniqueName
=
"OldMaintenanceShort"
DataField
=
"OldMaintenanceShort"
SortExpression
=
"OldMaintenanceShort"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblDayTradeShort"
Text='<%# DataBinder.Eval(Container.DataItem, "OldMaintenanceShort")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Modified By"
UniqueName
=
"ModifiedBy"
DataField
=
"ModifiedBy"
SortExpression
=
"ModifiedBy"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Modified Date"
UniqueName
=
"ModifiedDate"
DataField
=
"ModifiedDate"
SortExpression
=
"ModifiedDate"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
FilterMenu
EnableTheming
=
"True"
>
<
CollapseAnimation
Duration
=
"200"
Type
=
"OutQuint"
/>
</
FilterMenu
>
</
telerik:RadGrid
>
</
asp:Panel
>
<
asp:ObjectDataSource
ID
=
"odsCorrespondentFirm"
runat
=
"server"
OldValuesParameterFormatString
=
"original_{0}"
SelectMethod
=
"RetrieveAllFirmsFromCorrespondents"
TypeName
=
"AdminWebsite.CorrespondentDataSource"
onselecting
=
"odsCorrespondentFirm_Selecting"
>
</
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"SecurityOverridesDS"
runat
=
"server"
OldValuesParameterFormatString
=
"original_{0}"
onselecting
=
"SecurityOverridesDS_Selecting"
SelectMethod
=
"RetrieveAllSecurityOverridessWithEqualFilter"
TypeName
=
"AdminWebsite.SecurityRequirementOverridesDataSource"
DeleteMethod
=
"DeleteSecurityRequirementOverridesByID"
InsertMethod
=
"CreateSecurityRequirementOverrides"
UpdateMethod
=
"UpdateSecurityRequirementOverridesByID"
>
<
DeleteParameters
>
<
asp:Parameter
Name
=
"tokenId"
Type
=
"Object"
/>
<
asp:Parameter
DbType
=
"Guid"
Name
=
"callerId"
/>
<
asp:Parameter
Name
=
"entityID"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"entityType"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"cusip"
Type
=
"String"
/>
</
DeleteParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"tokenId"
Type
=
"Object"
/>
<
asp:Parameter
DbType
=
"Guid"
Name
=
"callerId"
/>
<
asp:Parameter
Name
=
"entityID"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"entityType"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"cusip"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"maintenanceLong"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"maintenanceShort"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"initialLong"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"initialShort"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"description"
Type
=
"String"
/>
</
UpdateParameters
>
<
SelectParameters
>
<
asp:Parameter
Name
=
"tokenId"
Type
=
"Object"
/>
<
asp:Parameter
DbType
=
"Guid"
Name
=
"callerId"
/>
<
asp:ControlParameter
ControlID
=
"txtSymbol"
Name
=
"Symbol"
PropertyName
=
"Text"
Type
=
"String"
/>
<
asp:ControlParameter
Name
=
"firm"
Type
=
"String"
ControlID
=
"rcbFirm"
PropertyName
=
"SelectedValue"
/>
<
asp:ControlParameter
ControlID
=
"rcbOverrideLevel"
Name
=
"overrideLevel"
PropertyName
=
"SelectedValue"
Type
=
"String"
DefaultValue
=
"-1"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
</
asp:Content
>
aspx.cs code
------------------
protected
void
rgSecuritySearchResults_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
ImageButton imgBtnEdit = dataItem.FindControl(
"imgBtnEdit"
)
as
ImageButton;
Label lblEntityID = dataItem.FindControl(
"lblEntityID"
)
as
Label;
Label lblEntityType = dataItem.FindControl(
"lblEntityType"
)
as
Label;
Label lblMaintenanceLong = dataItem.FindControl(
"lblMaintenanceLong"
)
as
Label;
Label lblMaintenanceShort = dataItem.FindControl(
"lblMaintenanceShort"
)
as
Label;
Label lblInitialLong = dataItem.FindControl(
"lblInitialLong"
)
as
Label;
Label lblInitialShort = dataItem.FindControl(
"lblInitialShort"
)
as
Label;
Label lblDayTradeLong = dataItem.FindControl(
"lblDayTradeLong"
)
as
Label;
Label lblDayTradeShort = dataItem.FindControl(
"lblDayTradeShort"
)
as
Label;
string
strEntityID = lblEntityID.Text;
string
strEntityType = lblEntityType.Text;
string
strMaintenanceLong = lblMaintenanceLong.Text;
string
strMaintenanceShort = lblMaintenanceShort.Text;
string
strInitialLong = lblInitialLong.Text;
string
strInitialShort = lblInitialShort.Text;
string
strDayTradeLong = lblDayTradeLong.Text;
string
strDayTradeShort = lblDayTradeShort.Text;
imgBtnEdit.Attributes.Add(
"onclick"
,
"javascript:ShowEditForm('"
+ strEntityID +
"' ,'"
+ strEntityType +
"','"
+ strMaintenanceLong +
"','"
+ strMaintenanceShort +
"','"
+ strDayTradeLong +
"','"
+ strDayTradeShort +
"'); return false;"
);
}
Page load event in popup window is not fired when window opens and hence am not able to capture query strings passed
through window.radopen()to new popup window. I can see the query strings values in the status bar of pop up window.
But i cant capture the query string and hence cant edit grid row
If i can fire the page load event in pop up, then problem is solved.
Please advise on this or any alternate approaches.