Benjamin Millspaugh
Top achievements
Rank 1
Benjamin Millspaugh
asked on 10 Mar 2008, 03:23 PM
I like the default CommandItem template and style but I would like the "Add new record" button to open a new window with a custom form in it. For most of my grids I can get away with the inline forms, but in this case I really need a new window and I was hoping to just use the existing command buttons in code somehow to open a new window with the form in it. Is there a way to control the target or action behind that button either in source or programtically without having to create a whole CommandItemTemplate that replicates the built-in functionality?
5 Answers, 1 is accepted
0
Hi Benjamin,
To see more information on the requested functionality, please refer to the following article.
I hope this information helps.
All the best,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
To see more information on the requested functionality, please refer to the following article.
I hope this information helps.
All the best,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Benjamin Millspaugh
Top achievements
Rank 1
answered on 12 Mar 2008, 01:13 PM
That article does not address my question at all. I will repeat my question for you:
Is there a was a way to control the target or action behind that button either in source or programtically without having to create a whole CommandItemTemplate that replicates the built-in functionality?
Is there a was a way to control the target or action behind that button either in source or programtically without having to create a whole CommandItemTemplate that replicates the built-in functionality?
0
Hi Benjamin,
You cannot use the default edit form, and simply open a new window, with the edit form in it. this functionality would require more coding, since the control cannot automatically get the newly inserted data from the editform, or render the edit form in another window. That is why I suggested the other approach.
Greetings,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You cannot use the default edit form, and simply open a new window, with the edit form in it. this functionality would require more coding, since the control cannot automatically get the newly inserted data from the editform, or render the edit form in another window. That is why I suggested the other approach.
Greetings,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Benjamin Millspaugh
Top achievements
Rank 1
answered on 12 Mar 2008, 01:54 PM
I did not ask if you could use the default form in a new window (although that would have been very nice). I asked if there was a way to programatically control the default button to make it do something else (such as open a new window).
0
Hello Benjamin,
Yes there is such a way, demonstrated by the code snippet below:
.cs
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Yes there is such a way, demonstrated by the code snippet below:
.cs
| protected void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| GridCommandItem commandItem = (GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0]; |
| LinkButton addNewRecord = (LinkButton)commandItem.FindControl("InitInsertButton"); |
| addNewRecord.Attributes["target"] = "_blank"; |
| } |
however, in the bigger context of using this functionality to handle the intended purpose of opening the insert/edit form in a new window, this would not work, and I would suggest using the already suggested approach.
All the best,
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center