G'day,
Here I have little problem with button click event fires after every
two click.
I have asp.net website and have 3 buttons generated dynamically on
page through a loop based on different access level permissions.
Following is a little code snippet attached. This code is a part of a
loop, Loop basically check the folders through the main and plus the
user access set in database. In simple term every single folder access
has been set in database and loop is going through the different level
of folder and check the folder path with the one stored in database
and if that matches it will check the access level (like giving user
group access to different user groups for this folder or folder rename
or folder remove)
//change your action tab code here,, as per the requirement
if (this._mBARUser)
{
ImageButton btnUserAccess = new
ImageButton();
btnUserAccess.ID =
btnUserAccess.UniqueID;
btnUserAccess.EnableViewState =
true;
btnUserAccess.ImageUrl =
@"App_Share/images/AccessMini.jpg";
btnUserAccess.ImageAlign =
ImageAlign.AbsMiddle;
btnUserAccess.Height =
Unit.Parse("20px");
btnUserAccess.Width =
Unit.Parse("20px");
btnUserAccess.CommandName =
Application["RootFolder"].ToString().Trim() + _mSFolder.Trim() + @"\"
+ svrDirs[i].Name;
btnUserAccess.Click += new
ImageClickEventHandler(btnUserAccess_Click);
btnUserAccess.ToolTip = "Set User
Access";
btnUserAccess.EnableViewState =
true;
y.Controls.Add(btnUserAccess);
}
if (this._mBRemove)
{
// please change following code in
regards to removing folder
// and change the image as well.
ImageButton btnFolderRemove = new
ImageButton();
btnFolderRemove.ID =
btnFolderRemove.UniqueID;
btnFolderRemove.EnableViewState =
true;
btnFolderRemove.ImageUrl =
@"App_Share/images/DeleteMini.jpg";
btnFolderRemove.ImageAlign =
ImageAlign.AbsMiddle;
btnFolderRemove.Height =
Unit.Parse("20px");
btnFolderRemove.Width =
Unit.Parse("20px");
btnFolderRemove.CommandName =
Application["RootFolder"].ToString().Trim() + _mSFolder.Trim() + @"\"
+ svrDirs[i].Name;
btnFolderRemove.Attributes.Add("onclick", "return confirm_delete();");
btnFolderRemove.ToolTip = "Remove
Folder";
btnFolderRemove.EnableViewState =
true;
btnFolderRemove.Click +=new
ImageClickEventHandler(btnFolderRemove_Click);
y.Controls.Add(btnFolderRemove);
}
if (this._mBRename)
{
// please change following code in
regards to removing folder
// and change the image as well.
ImageButton btnFolderRename = new
ImageButton();
btnFolderRename.ID =
btnFolderRename.UniqueID;
btnFolderRename.EnableViewState =
true;
btnFolderRename.ImageUrl =
@"App_Share/images/RenamePenMini.jpg";
btnFolderRename.ImageAlign =
ImageAlign.AbsMiddle;
btnFolderRename.Height =
Unit.Parse("20px");
btnFolderRename.Width =
Unit.Parse("20px");
btnFolderRename.CommandName =
Application["RootFolder"].ToString().Trim() + _mSFolder.Trim() + @"\"
+ svrDirs[i].Name;
btnFolderRename.CommandArgument =
"1";
btnFolderRename.EnableViewState =
true;
btnFolderRename.Click += new
ImageClickEventHandler(btnFolderRename_Click);
btnFolderRename.ToolTip = "Rename
Folder";
y.Controls.Add(btnFolderRename);
}
Now the problem.
=============
Problem strats when it comes to handling those dynamic button click
events. Everytime when I click button it seems it goes to client side
javascript (attached to one of the button just to check the response
from the user like delete or not) but it does not do anything. To run
the button click event successfully I have to click the same button
twice.
Need little help for this.
Thanks,
Sunny
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---