Why, why, why???

Discussion in 'ASP .Net' started by =?Utf-8?B?VGltOjouLg==?=, Jan 27, 2005.

  1. Hi...

    Can someone please tell me why my querystring isn't returning anything!

    I have a called viewpage.aspx that contains a datagrid with the following
    linkcolumn

    <asp:hyperlinkcolumn DataNavigateUrlField="pageid"
    DataNavigateUrlFormatString="editor.aspx?id={0}" Text="<img border=0
    src=../images/edit.gif alt=Edit Page>">

    When I run the code the id is sent to editor.aspx which is visable in the
    address bar so I know it is working. However when I try to request the
    querystring it returns rowID=0

    WHY???

    Would appritiate any advice... thanks

    CODE..

    Private rowID As Integer = 1

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    'Get Text for Editor
    If Not Page.IsPostBack Then
    rowID = CType(Request.QueryString(ID), Integer)
    FreeTextBox1.Text = GetDocument()
    End If


    End Sub 'Page_Load

    Public Sub Button_Click(ByVal sender As Object, ByVal e As
    System.EventArgs)
    UpdateDocument(FreeTextBox1.Text)
    End Sub 'Button_Click

    Private Function GetDocument() As String
    Dim ds As DataSet = GetDataSet(("SELECT content FROM tblPageContent
    WHERE pageID=" + rowID.ToString()))
    Dim table As DataTable = ds.Tables(0)
    Dim row As DataRow = table.Rows(0)
    Dim doc As String = row("content").ToString()
    Return doc
    ds.Dispose()
    End Function 'GetDocument
    =?Utf-8?B?VGltOjouLg==?=, Jan 27, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?VGltOjouLg==?=

    Marina Guest

    You are indexing by ID. What is ID. Is this a variable you have defined
    somewhere? What is its value?

    You need to use Request.QueryString("id"), to get the value of the variable
    called 'id'.

    "Tim::.." <myatix_at_hotmail.com> wrote in message
    news:...
    > Hi...
    >
    > Can someone please tell me why my querystring isn't returning anything!
    >
    > I have a called viewpage.aspx that contains a datagrid with the following
    > linkcolumn
    >
    > <asp:hyperlinkcolumn DataNavigateUrlField="pageid"
    > DataNavigateUrlFormatString="editor.aspx?id={0}" Text="<img border=0
    > src=../images/edit.gif alt=Edit Page>">
    >
    > When I run the code the id is sent to editor.aspx which is visable in the
    > address bar so I know it is working. However when I try to request the
    > querystring it returns rowID=0
    >
    > WHY???
    >
    > Would appritiate any advice... thanks
    >
    > CODE..
    >
    > Private rowID As Integer = 1
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    >
    > 'Get Text for Editor
    > If Not Page.IsPostBack Then
    > rowID = CType(Request.QueryString(ID), Integer)
    > FreeTextBox1.Text = GetDocument()
    > End If
    >
    >
    > End Sub 'Page_Load
    >
    > Public Sub Button_Click(ByVal sender As Object, ByVal e As
    > System.EventArgs)
    > UpdateDocument(FreeTextBox1.Text)
    > End Sub 'Button_Click
    >
    > Private Function GetDocument() As String
    > Dim ds As DataSet = GetDataSet(("SELECT content FROM tblPageContent
    > WHERE pageID=" + rowID.ToString()))
    > Dim table As DataTable = ds.Tables(0)
    > Dim row As DataRow = table.Rows(0)
    > Dim doc As String = row("content").ToString()
    > Return doc
    > ds.Dispose()
    > End Function 'GetDocument
    Marina, Jan 27, 2005
    #2
    1. Advertising

  3. Thanks! I was missing the quotes!


    Can you then explain why the variable rowID resets itself to equal nothing
    when it hits this function!

    Thanks

    Private Sub UpdateDocument(ByVal doc As String)
    Dim strSQL As String = ""
    strSQL += "UPDATE tblPageContent SET content='"
    strSQL += (doc.Replace(Chr(39), Chr(39) + Chr(39)))
    strSQL += "' WHERE pageID=" + rowID.ToString()
    RunQuery((strSQL))
    End Sub 'UpdateDocument

    "Marina" wrote:

    > You are indexing by ID. What is ID. Is this a variable you have defined
    > somewhere? What is its value?
    >
    > You need to use Request.QueryString("id"), to get the value of the variable
    > called 'id'.
    >
    > "Tim::.." <myatix_at_hotmail.com> wrote in message
    > news:...
    > > Hi...
    > >
    > > Can someone please tell me why my querystring isn't returning anything!
    > >
    > > I have a called viewpage.aspx that contains a datagrid with the following
    > > linkcolumn
    > >
    > > <asp:hyperlinkcolumn DataNavigateUrlField="pageid"
    > > DataNavigateUrlFormatString="editor.aspx?id={0}" Text="<img border=0
    > > src=../images/edit.gif alt=Edit Page>">
    > >
    > > When I run the code the id is sent to editor.aspx which is visable in the
    > > address bar so I know it is working. However when I try to request the
    > > querystring it returns rowID=0
    > >
    > > WHY???
    > >
    > > Would appritiate any advice... thanks
    > >
    > > CODE..
    > >
    > > Private rowID As Integer = 1
    > >
    > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles MyBase.Load
    > >
    > > 'Get Text for Editor
    > > If Not Page.IsPostBack Then
    > > rowID = CType(Request.QueryString(ID), Integer)
    > > FreeTextBox1.Text = GetDocument()
    > > End If
    > >
    > >
    > > End Sub 'Page_Load
    > >
    > > Public Sub Button_Click(ByVal sender As Object, ByVal e As
    > > System.EventArgs)
    > > UpdateDocument(FreeTextBox1.Text)
    > > End Sub 'Button_Click
    > >
    > > Private Function GetDocument() As String
    > > Dim ds As DataSet = GetDataSet(("SELECT content FROM tblPageContent
    > > WHERE pageID=" + rowID.ToString()))
    > > Dim table As DataTable = ds.Tables(0)
    > > Dim row As DataRow = table.Rows(0)
    > > Dim doc As String = row("content").ToString()
    > > Return doc
    > > ds.Dispose()
    > > End Function 'GetDocument

    >
    >
    >
    =?Utf-8?B?VGltOjouLg==?=, Jan 27, 2005
    #3
  4. =?Utf-8?B?VGltOjouLg==?=

    Marina Guest

    An integer variable can never be nothing. It can be 0, it will never be a
    null reference.

    If you are setting the variable to a query string variable that wasn't
    found, then casting nothing to an integer will result in your integer
    variable being set to 0.

    You can't post little separate snippets and ask why the variable got set to
    nothing, or anything else. Any number of pieces of code could have run
    before this function was hit that could have changed it. We don't know what
    you have.

    "Tim::.." <myatix_at_hotmail.com> wrote in message
    news:...
    > Thanks! I was missing the quotes!
    >
    >
    > Can you then explain why the variable rowID resets itself to equal
    > nothing
    > when it hits this function!
    >
    > Thanks
    >
    > Private Sub UpdateDocument(ByVal doc As String)
    > Dim strSQL As String = ""
    > strSQL += "UPDATE tblPageContent SET content='"
    > strSQL += (doc.Replace(Chr(39), Chr(39) + Chr(39)))
    > strSQL += "' WHERE pageID=" + rowID.ToString()
    > RunQuery((strSQL))
    > End Sub 'UpdateDocument
    >
    > "Marina" wrote:
    >
    >> You are indexing by ID. What is ID. Is this a variable you have defined
    >> somewhere? What is its value?
    >>
    >> You need to use Request.QueryString("id"), to get the value of the
    >> variable
    >> called 'id'.
    >>
    >> "Tim::.." <myatix_at_hotmail.com> wrote in message
    >> news:...
    >> > Hi...
    >> >
    >> > Can someone please tell me why my querystring isn't returning anything!
    >> >
    >> > I have a called viewpage.aspx that contains a datagrid with the
    >> > following
    >> > linkcolumn
    >> >
    >> > <asp:hyperlinkcolumn DataNavigateUrlField="pageid"
    >> > DataNavigateUrlFormatString="editor.aspx?id={0}" Text="<img border=0
    >> > src=../images/edit.gif alt=Edit Page>">
    >> >
    >> > When I run the code the id is sent to editor.aspx which is visable in
    >> > the
    >> > address bar so I know it is working. However when I try to request the
    >> > querystring it returns rowID=0
    >> >
    >> > WHY???
    >> >
    >> > Would appritiate any advice... thanks
    >> >
    >> > CODE..
    >> >
    >> > Private rowID As Integer = 1
    >> >
    >> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    >> > System.EventArgs) Handles MyBase.Load
    >> >
    >> > 'Get Text for Editor
    >> > If Not Page.IsPostBack Then
    >> > rowID = CType(Request.QueryString(ID), Integer)
    >> > FreeTextBox1.Text = GetDocument()
    >> > End If
    >> >
    >> >
    >> > End Sub 'Page_Load
    >> >
    >> > Public Sub Button_Click(ByVal sender As Object, ByVal e As
    >> > System.EventArgs)
    >> > UpdateDocument(FreeTextBox1.Text)
    >> > End Sub 'Button_Click
    >> >
    >> > Private Function GetDocument() As String
    >> > Dim ds As DataSet = GetDataSet(("SELECT content FROM
    >> > tblPageContent
    >> > WHERE pageID=" + rowID.ToString()))
    >> > Dim table As DataTable = ds.Tables(0)
    >> > Dim row As DataRow = table.Rows(0)
    >> > Dim doc As String = row("content").ToString()
    >> > Return doc
    >> > ds.Dispose()
    >> > End Function 'GetDocument

    >>
    >>
    >>
    Marina, Jan 27, 2005
    #4
  5. =?Utf-8?B?VGltOjouLg==?=

    Patrice Guest

    How do you know it's "nothing" ?

    Patrice

    --

    "Tim::.." <myatix_at_hotmail.com> a écrit dans le message de
    news:...
    > Thanks! I was missing the quotes!
    >
    >
    > Can you then explain why the variable rowID resets itself to equal

    nothing
    > when it hits this function!
    >
    > Thanks
    >
    > Private Sub UpdateDocument(ByVal doc As String)
    > Dim strSQL As String = ""
    > strSQL += "UPDATE tblPageContent SET content='"
    > strSQL += (doc.Replace(Chr(39), Chr(39) + Chr(39)))
    > strSQL += "' WHERE pageID=" + rowID.ToString()
    > RunQuery((strSQL))
    > End Sub 'UpdateDocument
    >
    > "Marina" wrote:
    >
    > > You are indexing by ID. What is ID. Is this a variable you have defined
    > > somewhere? What is its value?
    > >
    > > You need to use Request.QueryString("id"), to get the value of the

    variable
    > > called 'id'.
    > >
    > > "Tim::.." <myatix_at_hotmail.com> wrote in message
    > > news:...
    > > > Hi...
    > > >
    > > > Can someone please tell me why my querystring isn't returning

    anything!
    > > >
    > > > I have a called viewpage.aspx that contains a datagrid with the

    following
    > > > linkcolumn
    > > >
    > > > <asp:hyperlinkcolumn DataNavigateUrlField="pageid"
    > > > DataNavigateUrlFormatString="editor.aspx?id={0}" Text="<img border=0
    > > > src=../images/edit.gif alt=Edit Page>">
    > > >
    > > > When I run the code the id is sent to editor.aspx which is visable in

    the
    > > > address bar so I know it is working. However when I try to request the
    > > > querystring it returns rowID=0
    > > >
    > > > WHY???
    > > >
    > > > Would appritiate any advice... thanks
    > > >
    > > > CODE..
    > > >
    > > > Private rowID As Integer = 1
    > > >
    > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > > System.EventArgs) Handles MyBase.Load
    > > >
    > > > 'Get Text for Editor
    > > > If Not Page.IsPostBack Then
    > > > rowID = CType(Request.QueryString(ID), Integer)
    > > > FreeTextBox1.Text = GetDocument()
    > > > End If
    > > >
    > > >
    > > > End Sub 'Page_Load
    > > >
    > > > Public Sub Button_Click(ByVal sender As Object, ByVal e As
    > > > System.EventArgs)
    > > > UpdateDocument(FreeTextBox1.Text)
    > > > End Sub 'Button_Click
    > > >
    > > > Private Function GetDocument() As String
    > > > Dim ds As DataSet = GetDataSet(("SELECT content FROM

    tblPageContent
    > > > WHERE pageID=" + rowID.ToString()))
    > > > Dim table As DataTable = ds.Tables(0)
    > > > Dim row As DataRow = table.Rows(0)
    > > > Dim doc As String = row("content").ToString()
    > > > Return doc
    > > > ds.Dispose()
    > > > End Function 'GetDocument

    > >
    > >
    > >
    Patrice, Jan 27, 2005
    #5
  6. OK!
    Thank you...

    "Marina" wrote:

    > An integer variable can never be nothing. It can be 0, it will never be a
    > null reference.
    >
    > If you are setting the variable to a query string variable that wasn't
    > found, then casting nothing to an integer will result in your integer
    > variable being set to 0.
    >
    > You can't post little separate snippets and ask why the variable got set to
    > nothing, or anything else. Any number of pieces of code could have run
    > before this function was hit that could have changed it. We don't know what
    > you have.
    >
    > "Tim::.." <myatix_at_hotmail.com> wrote in message
    > news:...
    > > Thanks! I was missing the quotes!
    > >
    > >
    > > Can you then explain why the variable rowID resets itself to equal
    > > nothing
    > > when it hits this function!
    > >
    > > Thanks
    > >
    > > Private Sub UpdateDocument(ByVal doc As String)
    > > Dim strSQL As String = ""
    > > strSQL += "UPDATE tblPageContent SET content='"
    > > strSQL += (doc.Replace(Chr(39), Chr(39) + Chr(39)))
    > > strSQL += "' WHERE pageID=" + rowID.ToString()
    > > RunQuery((strSQL))
    > > End Sub 'UpdateDocument
    > >
    > > "Marina" wrote:
    > >
    > >> You are indexing by ID. What is ID. Is this a variable you have defined
    > >> somewhere? What is its value?
    > >>
    > >> You need to use Request.QueryString("id"), to get the value of the
    > >> variable
    > >> called 'id'.
    > >>
    > >> "Tim::.." <myatix_at_hotmail.com> wrote in message
    > >> news:...
    > >> > Hi...
    > >> >
    > >> > Can someone please tell me why my querystring isn't returning anything!
    > >> >
    > >> > I have a called viewpage.aspx that contains a datagrid with the
    > >> > following
    > >> > linkcolumn
    > >> >
    > >> > <asp:hyperlinkcolumn DataNavigateUrlField="pageid"
    > >> > DataNavigateUrlFormatString="editor.aspx?id={0}" Text="<img border=0
    > >> > src=../images/edit.gif alt=Edit Page>">
    > >> >
    > >> > When I run the code the id is sent to editor.aspx which is visable in
    > >> > the
    > >> > address bar so I know it is working. However when I try to request the
    > >> > querystring it returns rowID=0
    > >> >
    > >> > WHY???
    > >> >
    > >> > Would appritiate any advice... thanks
    > >> >
    > >> > CODE..
    > >> >
    > >> > Private rowID As Integer = 1
    > >> >
    > >> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > >> > System.EventArgs) Handles MyBase.Load
    > >> >
    > >> > 'Get Text for Editor
    > >> > If Not Page.IsPostBack Then
    > >> > rowID = CType(Request.QueryString(ID), Integer)
    > >> > FreeTextBox1.Text = GetDocument()
    > >> > End If
    > >> >
    > >> >
    > >> > End Sub 'Page_Load
    > >> >
    > >> > Public Sub Button_Click(ByVal sender As Object, ByVal e As
    > >> > System.EventArgs)
    > >> > UpdateDocument(FreeTextBox1.Text)
    > >> > End Sub 'Button_Click
    > >> >
    > >> > Private Function GetDocument() As String
    > >> > Dim ds As DataSet = GetDataSet(("SELECT content FROM
    > >> > tblPageContent
    > >> > WHERE pageID=" + rowID.ToString()))
    > >> > Dim table As DataTable = ds.Tables(0)
    > >> > Dim row As DataRow = table.Rows(0)
    > >> > Dim doc As String = row("content").ToString()
    > >> > Return doc
    > >> > ds.Dispose()
    > >> > End Function 'GetDocument
    > >>
    > >>
    > >>

    >
    >
    >
    =?Utf-8?B?VGltOjouLg==?=, Jan 27, 2005
    #6
  7. Tim,

    although this is an ASP.NET newsgroup, and your
    question does constitute an ASP.NET code issue,
    did you know that questions about FreeTextBox
    coding will probably have a better chance of being
    expertly answered at the FreeTextBox Forums ?

    http://www.freetextbox.com/forums/




    Juan T. Llibre
    ASP.NET MVP
    ===========
    "Tim::.." <myatix_at_hotmail.com> wrote in message
    news:...
    > OK!
    > Thank you...
    >
    > "Marina" wrote:
    >
    >> An integer variable can never be nothing. It can be 0, it will never be a
    >> null reference.
    >>
    >> If you are setting the variable to a query string variable that wasn't
    >> found, then casting nothing to an integer will result in your integer
    >> variable being set to 0.
    >>
    >> You can't post little separate snippets and ask why the variable got set
    >> to
    >> nothing, or anything else. Any number of pieces of code could have run
    >> before this function was hit that could have changed it. We don't know
    >> what
    >> you have.
    >>
    >> "Tim::.." <myatix_at_hotmail.com> wrote in message
    >> news:...
    >> > Thanks! I was missing the quotes!
    >> >
    >> >
    >> > Can you then explain why the variable rowID resets itself to equal
    >> > nothing
    >> > when it hits this function!
    >> >
    >> > Thanks
    >> >
    >> > Private Sub UpdateDocument(ByVal doc As String)
    >> > Dim strSQL As String = ""
    >> > strSQL += "UPDATE tblPageContent SET content='"
    >> > strSQL += (doc.Replace(Chr(39), Chr(39) + Chr(39)))
    >> > strSQL += "' WHERE pageID=" + rowID.ToString()
    >> > RunQuery((strSQL))
    >> > End Sub 'UpdateDocument
    >> >
    >> > "Marina" wrote:
    >> >
    >> >> You are indexing by ID. What is ID. Is this a variable you have
    >> >> defined
    >> >> somewhere? What is its value?
    >> >>
    >> >> You need to use Request.QueryString("id"), to get the value of the
    >> >> variable
    >> >> called 'id'.
    >> >>
    >> >> "Tim::.." <myatix_at_hotmail.com> wrote in message
    >> >> news:...
    >> >> > Hi...
    >> >> >
    >> >> > Can someone please tell me why my querystring isn't returning
    >> >> > anything!
    >> >> >
    >> >> > I have a called viewpage.aspx that contains a datagrid with the
    >> >> > following
    >> >> > linkcolumn
    >> >> >
    >> >> > <asp:hyperlinkcolumn DataNavigateUrlField="pageid"
    >> >> > DataNavigateUrlFormatString="editor.aspx?id={0}" Text="<img border=0
    >> >> > src=../images/edit.gif alt=Edit Page>">
    >> >> >
    >> >> > When I run the code the id is sent to editor.aspx which is visable
    >> >> > in
    >> >> > the
    >> >> > address bar so I know it is working. However when I try to request
    >> >> > the
    >> >> > querystring it returns rowID=0
    >> >> >
    >> >> > WHY???
    >> >> >
    >> >> > Would appritiate any advice... thanks
    >> >> >
    >> >> > CODE..
    >> >> >
    >> >> > Private rowID As Integer = 1
    >> >> >
    >> >> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    >> >> > System.EventArgs) Handles MyBase.Load
    >> >> >
    >> >> > 'Get Text for Editor
    >> >> > If Not Page.IsPostBack Then
    >> >> > rowID = CType(Request.QueryString(ID), Integer)
    >> >> > FreeTextBox1.Text = GetDocument()
    >> >> > End If
    >> >> >
    >> >> >
    >> >> > End Sub 'Page_Load
    >> >> >
    >> >> > Public Sub Button_Click(ByVal sender As Object, ByVal e As
    >> >> > System.EventArgs)
    >> >> > UpdateDocument(FreeTextBox1.Text)
    >> >> > End Sub 'Button_Click
    >> >> >
    >> >> > Private Function GetDocument() As String
    >> >> > Dim ds As DataSet = GetDataSet(("SELECT content FROM
    >> >> > tblPageContent
    >> >> > WHERE pageID=" + rowID.ToString()))
    >> >> > Dim table As DataTable = ds.Tables(0)
    >> >> > Dim row As DataRow = table.Rows(0)
    >> >> > Dim doc As String = row("content").ToString()
    >> >> > Return doc
    >> >> > ds.Dispose()
    >> >> > End Function 'GetDocument
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>
    Juan T. Llibre, Jan 27, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Horace Nunley

    why why why does function not work

    Horace Nunley, Sep 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    452
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Sep 27, 2006
  2. Mr. SweatyFinger

    VWD why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    372
    =?Utf-8?B?Q2lhcmFuIE8nJycnRG9ubmVsbA==?=
    Dec 21, 2006
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    863
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger

    why why why usercontrol

    Mr. SweatyFinger, Nov 29, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    318
    Steve B.
    Nov 29, 2006
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,769
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page