ASP.NET - C# LinkButton Sender.Attributes Not Working

I am generating a list of people.  I am using the link button to allow a user to click on a person to get info on that person and continue processing on another page.

I have the below code on my .NET page
 <asp:LinkButton ID="lbPerson" runat="server" OnClick="selectPerson" 
                                EmpID='<%# DataBinder.Eval(Container, "DataItem.emp_id")%>' 
                                FirstName='<%#DataBinder.Eval(Container, "dataItem.ins_first") %>' 
                                LastName='<%#DataBinder.Eval(Container, "dataItem.ins_last") %>' >
                                <%#DataBinder.Eval(Container, "dataItem.ins_first") %>&nbsp<%#DataBinder.Eval(Container, "dataItem.ins_last") %>
</asp:LinkButton>

Open in new window


I have the below code in my code behind page

    protected void selectPerson(object sender, EventArgs e)
    {

        LinkButton _sender = (LinkButton)sender;
        string firstName = _sender.Attributes["FirstName"].ToString();
        string lastName = _sender.Attributes["LastName"].ToString();
        int empID = Convert.ToInt32(_sender.Attributes["EmpID"].ToString());

Open in new window


As I walk through the code all of the attributes are "NULL".  i have used this same code in numerous applications and I do not see why it's not working here.  Any ideas?
LVL 2
CipherISAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MrunalCommented:
Hi,
you can do it in different way like passing parameters to same function like:

<asp:LinkButton ID="lbPerson" runat="server" 
  OnClick="selectPerson('<%# Eval("DataItem.emp_id")%>', '<%#Eval("dataItem.ins_first") %>', '<%#Eval("dataItem.ins_last") %>')" >
<%#Eval("dataItem.ins_first") %>&nbsp<%#Eval("dataItem.ins_last") %>
</asp:LinkButton>

Open in new window


and in code behind function is:

protected void selectPerson(object empid, object fname, object lname)
        {

        }

Open in new window


Hope this helps you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CipherISAuthor Commented:
I'm receiving a "New line in constant" error.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.