Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0SecurityRoles.ascx ... ondeletecommand="grdUserRoles_Delete" Why CanSecurityRoles.ascx ... ondeletecommand="grdUserRoles_Delete" Why Can't I?
Previous
 
Next
New Post
3/23/2006 4:25 PM
 

So basically, I wanted to simply create a module that looks very similiar to this one, so I thought ... copy the code, change a few things and walla...What Did I do Wrong?

Can anyone tell me why the Following Code works in the admin/security/securityroles.ascx and related .VB , but when I try it in my code, the event equivalent of grdUserRoles_Delete NEVER fires?

 ...

<asp:datagrid id=grdUserRoles runat="server" width="100%" summary="Security Roles Design Table" border="0" cellpadding="4" cellspacing="0" autogeneratecolumns="false" enableviewstate="false" datakeyfield="UserRoleID" ondeletecommand="grdUserRoles_Delete" BorderStyle="None" BorderWidth="0px" GridLines="None">

<Columns>

<asp:TemplateColumn>

<ItemTemplate>

<asp:imagebutton id="cmdDeleteUserRole" runat="server" alternatetext="Delete" causesvalidation="False" commandname="Delete" imageurl="~/images/delete.gif" resourcekey="cmdDelete"></asp:imagebutton>

</ItemTemplate>

</asp:TemplateColumn>

And in the securityroles.ascx.vb ...

 Public Sub grdUserRoles_Delete(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)

Try
...
End Try

End Sub

 

Now, you may jump to the conclusion that the sub does not handle the grdUUserRoles_DeleteCommand ... but as I said the above code works, it is core DNN.... Look at it. Why?

How does the cmdDeleteUserRole get an ID, select the record, pass a value, etc?  makes no sense to me.

Is the grdUserRoles_ItemCreated somehow assigning this behavior?

I give.  Please advise, or show me what stupid thing I'm missing.

Thanks!

Chuck

 

 

 

 
New Post
3/23/2006 7:34 PM
 

If your declaritive code in the .ascx is the same as you've postes, the grdUserRoles_Delete sub should be called whenever the "Delete" image button is clicked. Be sure that:

1. In the datagrid control markup the attribute setting ondeletecommand="grdUserRoles_Delete" correctly refers to name of the subroutine that handles the delete.

2. In the "Delete" image button the attribute setting commandname="Delete" has not been changed to a different comand name. It must be "Delete" for the event linkage to work.

If you are not able to get the event linkage to work this way, you could remove the ondeletecommand="grdUserRoles_Delete" from the datagrid control markup and change the delete event handler declaration to:

Public Sub grdUserRoles_Delete(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles grdUserRoles.DeleteCommand

I've had some problems with loosing event handler linkage when VS2003/ASP.NET 1.1 codebehinds are converted to VS2005/ASP.NET 2.0 codefiles and their Partial Class design.

As for your other questions:

In securityroles.ascx.vb, the grdUserRoles_ItemCreated handler adds (using the ClientAPI) an onclick attribute that will raise a javascript confirm box.  If you are doing likewise, are you seeing the confirm box appear when the Delete image button is clicked?

In the grdUserRoles_Delete handler in securityroles.ascx.vb, the RoleId or UserId (depending on whether the datagrid is displaying roles or users) is obtained from the datagrid's DataKeys collection using the index passed to the subroutine in the e parameter which is of class DataGridCommandEventArgs:    

      grdUserRoles.DataKeys(e.Item.ItemIndex)


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
4/13/2006 11:03 AM
 
Thanks for your reply, I did get it working after a number of reboots, re-compiles,  retyping, etc.  Then I couldn't break it again.  I'm chalking it up to a flaky conversion issue or the ASP.NET Development Web Server (Casini?) ... or just an ID10T issue ;)
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0SecurityRoles.ascx ... ondeletecommand="grdUserRoles_Delete" Why CanSecurityRoles.ascx ... ondeletecommand="grdUserRoles_Delete" Why Can't I?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out