How can I add an invisible form variable?

I have a manual table and I was wondering if there is anyway I can add an invisible form variable or text box. The reason I need it is so I can set it equal to the Title and set that to a session that I can reference throughout the rest of the application. This is the code I have. Any help would be appreciated.
Try
            dtr = Mycomm.ExecuteReader()
            If dtr.HasRows Then
                While dtr.Read()
 
                    If dtr("Title") = "" And dtr("Description") = "" Then
                    Else
                        success = "true"
                        vHtml = vHtml & "<TD align=""left""><FONT size=""1"" face=""Verdana""><a href='edit_election.aspx?id=" & dtr("id") & "'>(edit election)</a> "
                        vHtml = vHtml & "| <a href='delete.aspx?eid=" & dtr("id") & "' onClick=""return confirm('All associated items and responses will be deleted with this election. \n Are you sure you wish to delete this election?')"">(delete election)</a> "
                        vHtml = vHtml & "| <a href='item_list.aspx?id=" & dtr("id") & "'>(edit items)</a>"
                        vHtml = vHtml & "| <a href='response_list.aspx?id=" & dtr("id") & "'>(edit responses)</a></FONT></TD>"
                        vTitle = Replace(dtr("Title"), "''", "'")
                        'vBody = Replace(dtr("Body"), "''", "'")
                        vBody = Replace(dtr("Description"), vbCrLf, "<br>")
                        vStart = dtr("StartDate")
                        vEnd = dtr("EndDate")
                        vHtml = vHtml & "<tr>"
                        vHtml = vHtml & "<TD align=""left""><strong><FONT face=""Verdana"" size=""3"">" & vTitle & "</FONT></strong></TD>"
                        vHtml = vHtml & "</tr>"
                        vHtml = vHtml & "<tr colspan =""2"">"
                        vHtml = vHtml & "<TD  align=""left""><FONT face=""Verdana"" size=""1"">Dates Available: " & vStart & "</FONT>&nbsp;-&nbsp;<FONT face=""Verdana"" size=""1"">" & vEnd & "</FONT><br></TD> "
                        'vHtml = vHtml & "<TD align=""left""><FONT face=""Verdana"" size=""1""><asp:TextBox id=""txtTitle"" runat=""server"" Visible=""True"">" & vTitle & "</asp:TextBox></FONT><br></TD>"
                        vHtml = vHtml & "</tr>"
                        vHtml = vHtml & "<TD align=""left""><FONT face=""Verdana"" size=""2"">" & vBody & "</FONT><br><br></TD>"
                        vHtml = vHtml & "</tr>"
                        vHtml = vHtml & "<tr>"
                    End If
                End While
            Else
                success = "false"
            End If
            vHtml = vHtml & "<tr bgcolor=""#818EAD""><td colspan='11' align='Right'><FONT face=""Verdana"" size=""1"">&nbsp;</font></td></tr>"
            vHtml = vHtml & "<tr bgcolor=""#FFFFFF"">"
            vHtml = vHtml & "<th colspan=""11"" align=""right"">"
            vHtml = vHtml & "<HR>"
            vHtml = vHtml & "<FONT face=""Verdana"" size=""1"">&nbsp;</FONT>"
            vHtml = vHtml & "</th>"
            vHtml = vHtml & "</table>"
        Catch
        End Try

Open in new window

savache27Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

matthewrhoadesCommented:
Is it VB.NET or ASP.NET?  If it is VB.NET you are looking for a global variable I believe.  If that is the case you can add a variable using the keyword Friend.  I usually have a vb file as part of my project called modGlobals or something of the sort and it looks like this:  (See code below)

You can access those variables from any place in your project by calling myCaseId, or myUpdateConnStr, etc...


Module modGlobals
    Friend myCaseId As Int16 = Nothing
    Friend myUpdateConnStr As String = "F00"
    Friend myConnStr As String = Nothing
    Friend myUserId As Int16 = Nothing
    Friend myRecordId As Int32 = Nothing
    Friend myConnStatus As Int16 = 1
End Module

Open in new window

0
savache27Author Commented:
Well, I'm working in visual studio and building a manual  table, so I guess I'm really using asp.net. It's basically a datalist of elections and each election has a title. So when I go into the edit page I would like to keep up with the Title and add it to the edit page.
0
matthewrhoadesCommented:
You can always add a text box and set the visible property to false.  Refer to the value of it using textboxname.text

You can also leave it visible and set the forecolor and backcolor of the text box to transparent.  

Or you can just store the information each time as SESSION["Title"]=vTitle so long as you have started a session at the beginning of your application.  
0
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

savache27Author Commented:
Actually, I don't think that will work for what I need because I would still have no way of telling which text box it was when they clicked on the edit since it's in a loop. Do you know anyway I could just add the title into this:

<a href='edit_election.aspx?id=" & dtr("id") & "'>(edit election)</a>

Seems like it would be something like this, but I'm just not sure how to add it in.

<a href='edit_election.aspx?id=" & dtr("id") & "' & "&title= " & vTitle & "  >(edit election)</a>
0
matthewrhoadesCommented:
link1.href = "edit_election.aspx?id=" & dtr("id") & "&title=" & vTitle
<a id = "link1" runat = "server">(edit election)</a>


Something along those lines should do for you.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
savache27Author Commented:
Thank you so much for your help!! That works perfectly!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.