0

Hi all...

I have one repeater control with check boxes in one of the page.My requirement is i have to pass the values of the row that i have checked (multiple check boxes can be selected at a time) when i click on a add button in the same page which is placed outside the repeater control.and, i want the details of the rows that i have selected to populate in another repeater control placed in a different page. how to do this using query string??

Plss help.............

Thanks in advance....

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Emiliya
0

There are many ways you can do this. In your OnClick even you could dump the results into a session,application, or viewstate variable. You could utilize Page.PreviousPage and find the controls status using a function similar to this:

Public Function GetControlById(ByVal ParentCntrl As Control, ByVal TargetCntrl As String) As Control
            Try
                Dim ctl As Control = ParentCntrl
                Dim ctls As New LinkedList(Of Control)
                While Not ctl.Equals(Nothing)
                    If ctl.ID = TargetCntrl Then
                        Return ctl
                    End If
                    For Each child As Control In ctl.Controls
                        If child.ID = TargetCntrl Then
                            Return child
                        End If
                        If child.HasControls Then
                            ctls.AddLast(child)
                        End If

                    Next
                    If Not ctls.First.Value.ClientID = Nothing Then
                        ctl = ctls.First.Value
                        ctls.Remove(ctl)
                    End If

                End While
                Return Nothing
            Catch ex As Exception
                ' ThrowError(ParentCntrl, ex.ToString)
            End Try
            
        End Function

ex:

dim ckbox1status as boolean = ctype(GetControlByID(Page.PreviousPage.Form, "chkbox1"),CheckBox).Checked

Note: I have never utilized Page.PreviousPage.Form with this function myself. I am just assuming it would work correctly.

You could also set a QueryString in your OnClick method.

Let me know if any of this helps or you need more direction on a particular route.

0

Oops...my function has a commented out line 'ThrowError(...) ..that Is my custom ErrorHandler ..ignore that or add HttpContext.Current.Responce.Write(ex.tostring) to output your errors.

0

Thanks for the reply.Can anyone tell a method by using querystring???

0

why querystring..?
when you hit the button which is outside Reapeater..

iterate through the repeater items and check which row is checked.

now once you know which row is checked, your next job is to create the datatable on the fly or any other collection you can think of ...which is easy to maintain.

next add this collection or datatable to session variable.

on the next page get data out of session using cast to datatable
and bind to the repeater..

i wont suggest to use querysting cos querystring holds the limited data..

think about a situation where you have 100 rows selected, do you think querystring
approach will work..?

0

Thanks for the reply ....Can u plss give a sample code for doing the same..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.