• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

cross page posting using detailsview

Hi Experts.
I'd like some pointers with the following please?
I have tried to crosspage post from  a source page which has a detailsview with a "textbox template" field with no success.
Here is the code that i have attempted on the target page - it compiles ok, but what have i missed out?
Thanks for your help..

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
            If Not Page.PreviousPage Is Nothing Then
            Dim SourceTextBox As TextBox
            SourceTextBox = CType(Page.PreviousPage.FindControl("TextBox1"), DetailsView).DataItem
            If Not SourceTextBox Is Nothing Then
                TextBox1.Text = SourceTextBox.Text
            End If
        End If
    End Sub
1 Solution
You'll have to use FindControl on the DetailsView itself as the TextBox is containted inside the DetailsView. Something like this:

SourceTextBox = CType(CType(Page.PreviousPage.FindControl("DetailsView1")).FindControl("TextBox1"), TextBox)
Forced accept.

EE Admin

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now