Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange problem
Message
From
08/04/2008 11:46:35
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01309020
Message ID:
01309037
Views:
8
>Hi everybody,
>
>I'm trying to figure out a strange problem with a GridView. I had everything working correctly using HiddenField technique, but I thought I would rather use a cleaner code without a need to use Hidden field and now I'm in trouble.
>
>See here:
>
>
>
>protected void grdvwUsers_RowDataBound(object sender, GridViewRowEventArgs e)
>    {
>        if (e.Row.RowType == DataControlRowType.DataRow)
>        {
>
>            LinkButton link = e.Row.FindControl("lnkbtnRemoveRole") as LinkButton;
>
>            if (link != null)
>            {
>
>                link.ToolTip = "Remove " +
>                    e.Row.DataItem.ToString() + " from the " +
>                    this.drpSelRole.SelectedValue + " role";
>
>                    link.Attributes["onclick"] =
>                    "HideElement('" + this.lblProfStat.ClientID +
>                    "');return confirm('Do you want to remove " +
>                    e.Row.DataItem.ToString() + " from role " +
>                    this.drpSelRole.SelectedValue + "?' );";
>                link.CommandArgument = e.Row.DataItem.ToString();
>            }
>        }
>    }
>
>	#region Buttons_in_grid
>	protected void lnkbtnRemoveRole_Click(object sender, EventArgs e)
>	{
>		//int index = this.grdvwUsers.SelectedIndex;
>		this.lblMsg.Text = "";
>		this.lblProfStat.Visible = false;
>		
>        LinkButton link = (LinkButton)sender;
>        string username = link.CommandArgument;
>
>Do I misunderstand something? Why in my RemoveRole click method the sender points to a different user and not to the user I saved in CommandArgument for the current row I clicked? The confirmation message shows correct information.
>
>Do you see my problem in the code above?
>
>Thanks in advance.
>
>UPDATE. I'm guessing that RowBound method happens again after I click on the Remove button for some reason...

I am guessing you are right. Set a breakpoint on it and see how many times it fires and what the value is each time.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform