Hi!
I have a radGrid on the page, which has a [AddNew] button that will trigger a <EditFormSettings> popup window.
Also, when users click on the Edit button on each row, I also have a code-behind ImgBtn.Attributes.Add("onclick", sb.ToString()) that will popup a window for users to edit data.
My problem now is when I click on the Edit button of the gridrow, both windows popup.
It was fine before I add DetailWin.focus to bring the popup to front. How can I fix this?
Attached is my code, thanks in advaned.
SH.
(aspx)
<
telerik:RadGrid
ID
=
"RadGd1"
AutoGenerateColumns
=
"false"
PageSize
=
"10"
AllowPaging
=
"true"
ShowFooter
=
"true"
AllowSorting
=
"true"
ShowStatusBar
=
"true"
AutoGenerateDeleteColumn
=
"false"
AllowAutomaticInserts
=
"false"
OnItemCreated
=
"RadGd1_ItemCreated"
OnNeedDataSource
=
"RadGd1_NeedDataSource"
OnItemDataBound
=
"RadGd1_ItemDataBound"
Width
=
"90%"
Skin
=
"Simple"
runat
=
"server"
>
<
MasterTableView
DataKeyNames
=
"FormId"
CommandItemDisplay
=
"Top"
CommandItemSettings-AddNewRecordText
=
"Add New"
>
<
CommandItemTemplate
>
<
asp:LinkButton
ID
=
"lkBtnAdd"
runat
=
"server"
CommandName
=
"InitInsert"
Visible='<%# !RadGd1.MasterTableView.IsItemInserted %>'>
<
img
style
=
"border:0px;vertical-align:bottom; height:16px; margin-top:6px;position:relative; float:left"
alt
=
"Add New"
src
=
"../images/document_add.png"
/>新增
</
asp:LinkButton
>
<
div
style
=
"padding-left:20px"
></
div
>
</
CommandItemTemplate
>
<
Columns
>
<
telerik:GridEditCommandColumn
UniqueName
=
"EditCmdCol"
ButtonType
=
"ImageButton"
ItemStyle-CssClass
=
""
ColumnGroupName
=
"cmdGroup"
EditImageUrl
=
"~/images/edit_data_20x19.png"
ItemStyle-Width
=
"20"
ItemStyle-Height
=
"19"
>
<
HeaderStyle
/>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"SaveAsDocCmdCol"
ButtonType
=
"ImageButton"
ItemStyle-CssClass
=
""
ColumnGroupName
=
"cmdGroup"
ImageUrl
=
"~/images/doc_save_as.png"
ItemStyle-Width
=
"16"
ItemStyle-Height
=
"16"
>
</
telerik:GridButtonColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"SaveAsPdfCmdCol"
ButtonType
=
"ImageButton"
ItemStyle-CssClass
=
""
ColumnGroupName
=
"cmdGroup"
ImageUrl
=
"~/images/pdfDownload_4.png"
ItemStyle-Width
=
"16"
ItemStyle-Height
=
"16"
>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"CustomerName"
DataField
=
"CustomerName"
UniqueName
=
"CustomerName"
ItemStyle-Width
=
"70px"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Created Time"
DataField
=
"CreateDT"
UniqueName
=
"CreateDT"
ItemStyle-Width
=
"100px"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Updated Time"
DataField
=
"SentDT"
UniqueName
=
"SentDT"
ItemStyle-Width
=
"100px"
></
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
UserControlName
=
"../UserControl/UCNewCSDetail.ascx"
EditFormType
=
"WebUserControl"
PopUpSettings-Height
=
"600px"
PopUpSettings-Width
=
"800px"
PopUpSettings-ScrollBars
=
"Vertical"
PopUpSettings-Modal
=
"true"
>
<
EditColumn
UniqueName
=
"EditCmdFrm"
></
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnPopUpShowing
=
"PopUpShowing"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
--------------------------------------------------------
(aspx.cs)
protected void RadGd1_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem oItem = (GridDataItem)e.Item;
string strFormId = RadGd1.MasterTableView.DataKeyValues[e.Item.ItemIndex]["FormId"].ToString();
StringBuilder sb = new StringBuilder();
sb.Append("var DetailWin = window.open");
sb.Append("('");
sb.Append("CSDetail.aspx?FormId=" + strFormId);
sb.Append("',");
sb.Append("'NewWindow',");
sb.Append("'scrollbars=yes,status=no,location=no,resizable=yes,Height=650,Width=1000,top=80,left=200'");
sb.AppendLine("); "); //return false;
sb.AppendLine("DetailWin.focus();");
ImageButton elemImgBtn = (ImageButton)oItem["EditCmdCol"].Controls[0];
elemImgBtn.Attributes.Add("href", "javscript:void(0);");
elemImgBtn.Attributes.Add("onclick", sb.ToString());
}
}