I finally after much irritation got the insert to work. Im new to the objectdatasource AND the rad controls.
I can't seem to get my datakey to show up as a parameter in my delete method...The delete is being called but the parameter is null. If you have any ideas about how to get the update to work that would be helpful also.
I can't seem to get my datakey to show up as a parameter in my delete method...The delete is being called but the parameter is null. If you have any ideas about how to get the update to work that would be helpful also.
| <asp:objectdatasource ID="objdsRoles" runat="server" |
| selectmethod="GetAllRoles" |
| deletemethod="DeleteRole" |
| insertmethod="InsertRole" |
| oldvaluesparameterformatstring="original_{0}" |
| typename="MyNamespace.Data.Helpers" |
| > |
| <insertparameters> |
| <asp:controlparameter controlid="txtRoleName" type="String" name="RoleName" /> |
| </insertparameters> |
| <deleteparameters> |
| <asp:parameter name="Role" type="String" /> |
| </deleteparameters> |
| </asp:objectdatasource> |
| <telerik:radgrid id="rgRoles" runat="server" |
| mastertableview-editmode="InPlace" |
| allowautomaticupdates="True" |
| datasourceid="objdsRoles" |
| gridlines="None" |
| autogenerateeditcolumn="True" |
| autogeneratedeletecolumn="true" |
| ondeletecommand="rgRoles_OnDeleteCommand"> |
| <headercontextmenu enabletheming="True"> |
| <collapseanimation duration="200" type="OutQuint" /> |
| </headercontextmenu> |
| <mastertableview datakeynames="Role"> |
| </mastertableview> |
| </telerik:radgrid> |
| //Code Behind stuffs.... |
| void rgRoles_OnDeleteCommand(object source, GridCommandEventArgs e) |
| { |
| objdsRoles.Delete(); |
| } |
| //Code to delete the roll that is showing the null value |
| public void DeleteRole( string Role ) |
| { |
| try |
| { |
| Roles.DeleteRole(Role, true); |
| } |
| catch( Exception ex ) |
| { |
| throw new Exception( "Failed to delete role.", ex ); |
| } |
| } |