Hi,
Currently I have some code present in a webform, I would like to call re-use this code and display the webform when "edit" button is clicked in RadGrid. I can use webusercontrolform option; but, for which I will have to duplicate the code and create a new user control.
So in summary, below are the requirements:
1) How to call existing webform when "Edit" is pressed on RadGrid?
2) I do not want to create new usercontrol and duplicate the same functionality.
Can you please advice whether this is possible in RadGrid??
Currently I have some code present in a webform, I would like to call re-use this code and display the webform when "edit" button is clicked in RadGrid. I can use webusercontrolform option; but, for which I will have to duplicate the code and create a new user control.
So in summary, below are the requirements:
1) How to call existing webform when "Edit" is pressed on RadGrid?
2) I do not want to create new usercontrol and duplicate the same functionality.
Can you please advice whether this is possible in RadGrid??
8 Answers, 1 is accepted
0

RvdGrint
Top achievements
Rank 1
answered on 21 Feb 2012, 09:03 AM
Ram,
you can catch the Edit command in the _ItemCommand function. If you cancell this event than you could open the WebForm from the code. In this case you should handle edit or update from the WebForm.
Regards,
Jos Meerkerk
you can catch the Edit command in the _ItemCommand function. If you cancell this event than you could open the WebForm from the code. In this case you should handle edit or update from the WebForm.
protected
void
rgRadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
switch
(e.CommandName)
{
case
RadGrid.EditCommandName:
{
e.Canceled =
true
;
int
iKey = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][
"KeyID"
].ToString());
// Open the WebForm with f.e. RadWindowManager
}
break
;
}
}
Regards,
Jos Meerkerk
0

Ram
Top achievements
Rank 1
answered on 21 Feb 2012, 11:00 AM
Hi JosM,
Thanks for reply. If we follow this, will the webform be displayed inside the RadGrid or will the webform be opened in a new window?
Actually, I need to use bulk-edit option in RadGrid. Hence, displaying the webform as a separate window will not yield my expected outcome. Kindly suggest me.
Thanks,
Ram
Thanks for reply. If we follow this, will the webform be displayed inside the RadGrid or will the webform be opened in a new window?
Actually, I need to use bulk-edit option in RadGrid. Hence, displaying the webform as a separate window will not yield my expected outcome. Kindly suggest me.
Thanks,
Ram
0

RvdGrint
Top achievements
Rank 1
answered on 21 Feb 2012, 11:08 AM
Ram,
RadWindowManager opens a new window using IFRAME.
You could change the WebForm and place it's content into a WebUserControl. This UserControl can be re-used in the Grid (see UserControl as EditForm in the Telerik demo's)
Regards,
Jos Meerkerk
RadWindowManager opens a new window using IFRAME.
You could change the WebForm and place it's content into a WebUserControl. This UserControl can be re-used in the Grid (see UserControl as EditForm in the Telerik demo's)
Regards,
Jos Meerkerk
0

Ram
Top achievements
Rank 1
answered on 21 Feb 2012, 11:12 AM
Hi JosM,
Thanks for quick reply. As you mentioned "RadWindowManager opens a new window using IFRAME." Could you please provide me sample code for this?
Thanks,
Ram
Thanks for quick reply. As you mentioned "RadWindowManager opens a new window using IFRAME." Could you please provide me sample code for this?
Thanks,
Ram
0

RvdGrint
Top achievements
Rank 1
answered on 21 Feb 2012, 11:18 AM
Ram,
When pressing on a button I call some Javascript (function RadWindowOpen is default provide by Telerik) to start the window without having a postback. In you're case maybe you need to open the window from the code behong.
Regards,
Jos Meerkerk
<
telerik:RadWindowManager
ID
=
"rwmHC"
runat
=
"server"
EnableShadow
=
"True"
ReloadOnShow
=
"True"
ShowContentDuringLoad
=
"False"
Skin
=
"Windows7"
VisibleStatusbar
=
"False"
style
=
"z-index:7001;"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"rwHCSetting"
runat
=
"server"
EnableShadow
=
"True"
NavigateUrl
=
"~/UC/TMS/PopUp/HourControlSetting.aspx"
ReloadOnShow
=
"True"
ShowContentDuringLoad
=
"False"
Skin
=
"Windows7"
Style="display: none;
width: 1000px; height: 650px;"
VisibleStatusbar
=
"false"
Width
=
"1000px"
Height
=
"650px"
Behaviors
=
"Move"
KeepInScreenBounds
=
"True"
AutoSizeBehaviors
=
"Default"
MinWidth
=
"1000px"
MinHeight
=
"650px"
MaxWidth
=
"1000px"
MaxHeight
=
"650px"
Overlay
=
"true"
InitialBehaviors
=
"Move"
Modal
=
"True"
Animation
=
"None"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
When pressing on a button I call some Javascript (function RadWindowOpen is default provide by Telerik) to start the window without having a postback. In you're case maybe you need to open the window from the code behong.
<
asp:ImageButton
ID
=
"btnSettings"
runat
=
"server"
OnClientClick
=
"RadWinOpen(null, 'rwHCSetting'); return false;"
onfocus
=
"this.blur()"
CssClass
=
"ActionButton"
CausesValidation
=
"False"
ImageUrl
=
"~/Images/EditForm/settings16x16.ico"
/>
Regards,
Jos Meerkerk
0

Ram
Top achievements
Rank 1
answered on 21 Feb 2012, 01:07 PM
Thanks JosM. I checked the below code; it is opening a new window. So, the only option left for me is to duplicate the code in usercontrol and need call the same in RadGrid when "Edit" is pressed.
0
Accepted

RvdGrint
Top achievements
Rank 1
answered on 21 Feb 2012, 01:15 PM
Ram,
That's what I told you, it is opening a new window.
Duplicating is not necessary. You could place the the content of the WebForm which you want to re-use in a WebUserControl. You can add this WebUserControl to the existing WebForm and use the samen UserControl for editing from the grid.
Regards,
JosM
That's what I told you, it is opening a new window.
Duplicating is not necessary. You could place the the content of the WebForm which you want to re-use in a WebUserControl. You can add this WebUserControl to the existing WebForm and use the samen UserControl for editing from the grid.
Regards,
JosM
0

Ram
Top achievements
Rank 1
answered on 22 Feb 2012, 01:53 AM
Thanks JosM - I will implement the same.