Gridview, Formview, Insert Databinding on Select

dprichard

New member
Joined
Oct 16, 2006
Messages
1
Programming Experience
Beginner
I would LOVE and worship any of you .NET gods for your help on this one!!!

Now that my sappy cry for help is over with.

I have a gridview that list employees. Each employee has a select link that I want to be able to choose to open up an insert for a formview. I want to put the employee ID into the Employee ID Text box automatically when I click the select and open up the formview.
I found several post where they got it working, but you had to click select twice to fill the box. Here is the code I came up with from that and of course I have the same problem where I have to hit select twice to fill the box. Please Please Please bestow some knowledge on this unworthy newbie!!! Thanks!

VB.NET:
[SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] GridView1_SelectedIndexChanged([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] GridView1.SelectedIndexChanged[/SIZE]
[SIZE=2]FormView1.PageIndex = GridView1.SelectedIndex[/SIZE]
[SIZE=2][COLOR=#0000ff]CType[/COLOR][/SIZE][SIZE=2](FormView1.FindControl([/SIZE][SIZE=2][COLOR=#800000]"emp_idTextBox"[/COLOR][/SIZE][SIZE=2]), TextBox).Text = GridView1.SelectedValue.ToString[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
 
Back
Top