shorak
asked on
Passing values from a DataRepeater control in VB.net
Hello everyone.
I have a dataRepeater on a form that displays some data from an underlying DataTable 'dsMovies'. The data repeater contains a textbox that is bound to a field in the data table (see code below)
tbMovieNames.DataBindings. Add(New Binding("Text", dsMovies, "title"))
DataRepeater1.DataSource = dsMovies
DataRepeater1.AllowUserToA ddItems = False
DataRepeater1.AllowUserToD eleteItems = False
The dataRepeater displays the data (which is a list of movies) as intended. What I want to do now, is to collect some values from a row when the user clicks on the textbox in the datarepeater. E.g. If a user clicks on a textbox (that displays the movie title), I want to save the movieID of that selected title in a global variable and then open another form that will display more information about the selected movie.
I dont have any problems opening a new form when the textbox is clicked on but I dont know how to save the movieid of the selected record. The underlying data table retrieves movieid, title and year from the database.
Could someone give me a step by step guide on how to do this?
Many thanks
Rob
I have a dataRepeater on a form that displays some data from an underlying DataTable 'dsMovies'. The data repeater contains a textbox that is bound to a field in the data table (see code below)
tbMovieNames.DataBindings.
DataRepeater1.DataSource = dsMovies
DataRepeater1.AllowUserToA
DataRepeater1.AllowUserToD
The dataRepeater displays the data (which is a list of movies) as intended. What I want to do now, is to collect some values from a row when the user clicks on the textbox in the datarepeater. E.g. If a user clicks on a textbox (that displays the movie title), I want to save the movieID of that selected title in a global variable and then open another form that will display more information about the selected movie.
I dont have any problems opening a new form when the textbox is clicked on but I dont know how to save the movieid of the selected record. The underlying data table retrieves movieid, title and year from the database.
Could someone give me a step by step guide on how to do this?
Many thanks
Rob
ASKER
Its a dataRepeater control (part of Vb Powerpack 3) and yes.. it is a winforms app. I am guessing that it behaves similarly to a datagridview control but allows you to create a custom layout of the fields as well as adding controls to each row.
Rob
Rob
Ok well certainly in a GridView you can have an event handler for code such as CellClick eg:
private void dataGridView1_CellClick(ob ject sender, DataGridViewCellEventArgs e)
{
MessageBox.Show(e.RowIndex .ToString( ));
}
Are there not simillar events in the Repeater Control?
private void dataGridView1_CellClick(ob
{
MessageBox.Show(e.RowIndex
}
Are there not simillar events in the Repeater Control?
ASKER
I'm quite new to vb.net so I'm not sure if if a datarepeater control has an even handler. I have found this link that might help but I think the code is in C# and not vb.net.
http://www.vbforums.com/showthread.php?t=557147
any ideas?
Rob
http://www.vbforums.com/showthread.php?t=557147
any ideas?
Rob
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This is a Winforms app right?