Jump to content

bblbailey3

Members
  • Posts

    10
  • Joined

  • Last visited

bblbailey3's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I've been looking into the latest two ideas...neither has worked quite yet...but I'm abandoning the idea for now, and I now plan to use the whole .visible thing. The label would have worked better...but it was more difficult to "see" the formatting. I stumbled across panels in my quest...and they allow me to effectively achieve the results I want.While it isn't what was suggested above...it is close enough that I humbling take my hat off and apologize. Most likely had you known exactly what I was doing you would have suggested the whole panel thing.I can handle dealing with panel visibility rather than every link and label and every other control that will pop up along the way.Again I appreciate all the help everyone has been so active in trying to give...if someone finds an exact answer (I hear panels and placeholders can supposedly do what I want) I would appreciate it.thanks -iii
  2. I really appreciate all the help everyone is trying to give. I'm rather frustrated and this is going to sound sarcastic...I need to explain even more I suppose.On page one I have a sort of index. That index has links. Each link targets the same label. SO a person can view the content desired by clicking each link (which then posts the data to the label). Easy enough.My problem is that I have a second page similar to the first but with a different index. To load that page from the first I use a link kinda similar to an asp:linkbutton. To load the proper data on load...I need to use "variables". Hence when I click the link it needs to run code...to make sure that the variable is set to the correct value.Because the data on my page is often displayed within or by changing the .text property of an asp:label and because part of that data might include a link to my second page...which of course requires code to be run to set the variable to the correct value...I might ask if there is a way to create an asp:linkbutton and text with in an asp:label (really long sentence). I don't want to hide links with the .visible command/property/thingy. What I was hoping is possible is simply this. Clicking on a link POSTS both the viewable data required, AND a link that can trigger a sub. So I click link 1 and it posts "Blah blah blah <asp:linkbutton onclick=sub id=something/>" to label.text (Notice the location of the asp button...it's between the quotes and also notice how that link is part of the .text property of label...)I don't know if this is possible...I certainly am doing what I can to research it. If anyone happens to know if this is truly possible... I would appreciate the help. Again I don't want visible/invisible links that would require me to create a label for all text until I hit a link. Then an invisible link. then another label, then another link....and the problem would compound for every link I need to use to display information to that area. I would be turning 30 links invisible and 45 visible and would have 60 labels...etc. I also don't want a link with changing text. Anyway...I hope I don't offend anyone...because seriously I'm just a bit frustrated and I know you are all trying to help a new person start up...and I really do appreciate it.
  3. Actually...I don't think I explained well enough...I want to click a link/button whatever thingy and it runs code likeLabel.text = "blah blah blah <asp:linkbutton onclick=runcode id=something/> blah blah blah"I.e the label has both text and a link that when clicked can run the sub runcode(). I'm not sure if there is an easy way to do that...End RESULT. I click a button or a link that edits the content of the label. It displays the new information and hopefully part of that new information are a few new links that when clicked can run existing subs.I mean I'm sure if I was writing in java or something like that I could set it all up...but preferably using vb...which is similar.I know there are ways to do it that create the illusion of doing what I want...but I'm not particularly fond of those particular ideas. I would prefer a "dynamic" solution (at least i think dynamic is the word).
  4. Ok here is the scenario. What I want: I click a button it displays text and some new links that run a code when I click it.Language...lol...no clue...I'm pretty sure I'm using VB.Currently the code reads Bodylbl1.text="<font face=arial><h1>WELCOME TO MY SITE</h1><BR>Currently MYSITE is down please go to <a href=somewhereelse.aspx>HERE</a>" It would be cool if I just wanted to send them "there"...but I need to run a tidbit of code first.Specifically something likeSub TidbitOfCode()Context.Items.add("Textbox","Text")Server.Transfer("somewhereelse.aspx", True)End SubI've tried just adding asp:linkbuttons into the label...but it doesn't display them...duh right...I've tried doing a variety of things...it seems like there should be an easy way to do what I want...but I haven't figured it out just yet.
  5. Found a solution not using the stupid text box too...Using the Context Items stuff Sub Button1onclick(sender As Object, e As System.EventArgs)Context.Items.add("TextBox","text")server.transfer("Page2.aspx", true)End SubThen on the second page if Context.Items("Textbox") = "text" then Label1 = "Blah Blah Blah"
  6. Hello again...still pretty new at this and I have something that I guess is rather odd that I am trying to do.The basic idea is this.Page 1 has multiple links. All of them point to Page 2. On Page 2 I would like to display information using an asp:label based on which link was clicked in the first screen.I have tried using the onlick command to change a "hidden" textbox's value and then load the page. The new page then reads the passed value and displays the correct info:Sub Button1onclick(sender As Object, e As System.EventArgs)TextBox.text="Button1"server.transfer("Page2.aspx", true)End Sub(A respective sub like this exists for each Button/Link/etc.)However the transfer occurs before the change to the TextBox and so Page 2 displays the information for whatever the text box value read prior to the buttonclick.Basically I could even use the OnTextChanged event if I could figure out how to "force" the browser to realize the text had changed...I'm sure a lot of you are wondering why do this at all...Why not just create separate pages for each link? For one I guess I'm a bit crazy and two I get confused trying to deal with tons of different pages. Reason three: Because I've peaked my interest in trying to solve this problem. Also, I do not want to display the information on the same page as that would cause a whole set of other problems.Hope someone can help.
  7. Forgot to say thanks.... Funny thing is I ended up starting over on my "test" file...and I created the code that works from scratch...I thought it was interesting how similar it was to yours which I had been trying to work on HOURS EARLIER and couldn't get to go at all. Thanks you for the help "pulpfiction" and anyone else who glanced at it....or wrote one of the pages I've been reading for hours...lolThanks for the help.
  8. I finally figured it out. I'll be adapting the code a bit more later...three days of research to find a simple ohhhh so easy answer...I'm dropping the code that works in...I hope someone else finds it useful. It is rather easy. <%@ Import Namespace="System.Data.OleDb" %><script runat="server">sub submit(sender As Object, e As System.EventArgs)dim dbconn,sql,dbcomm,dbreaddbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("[color="#FFA500"]YOURDATABASEPATH[/color]"))dbconn.Open()sql="SELECT [color="#2E8B57"]COLUMN[/color] FROM [color="#4169E1"]TABLE[/color] Where [color="#2E8B57"]COLUMN[/color]='" & [color="#9932CC"]request.form("User1")[/color] & "'"dbcomm=New OleDbCommand(sql,dbconn)dbread=dbcomm.ExecuteScalar()[color="#FF0000"]lbl.text=dbread[/color][color="#8B0000"]<%-- switch out the lbl.text for any kind of test you need...for example:if dbread=homer then...etc...I'm sure I'm the only idiot that takes forever to get it figured out...lol.---%>[/color]dbconn.close()dbconn=Nothingend sub</script><html><body><form runat="server">E-Mail Address*: <asp:TextBox id="User1" runat="server" columns=30 maxlength=30 /><br><br><asp:Button OnClick="submit" Text="Create Account" runat="server"/><BR><BR><BR><asp:Label id="lbl" runat="server"/></form></body></html>
  9. I've tried the code you provided and it doesn't work out well...I had to tweak it alot till it finally gave an error message about expecting the sql to start with SELECT INSERT DELETE UPDATE. Thanks for the effort.I'm still looking on my end...getting rather frustrated...It seems to be something everyone should want...I mean IF the data already exists in the table don't try to put it in.
  10. I'd say I'm rather new at all this. I've grasped quite a bit by reading...and reading...and reading...to be honest this is my third day playing with asp.net/ado.net (my first week at doing anything with web based data access) I have no idea what things mean...I just know how to make them work...most of the time. I have spent a full two days trying to figure out the answer to my question.My question is:How can I run the Insert SQL code IF and only IF the Request.forms("User1") doesn't already exist in the "TABLEName" User Column?The basic idea for the project is that I have a web-based form (Form.aspx) which has a submit button. I click the button submit...it grabs the data and plunks it into the database. Then sends the user to a different page...Basically I want something like this to be included:If request.forms("User1") Exists In TABLEName([user]) then recordexistslbl.text = "The user name already exists"Else continue with the "sql add record through the transfer to new web page" partEnd IfThe "User" is a unique field in my database so it can only return one record...when queried using a WHERE clause...for exampleI mean it was pretty simple in ADO and record sets....I'm sure I've just overlooked something. Again...I'm new so I hope I explained everything clearly...in my non-professional/experienced way.Here is the relevant code so far. (Sqlver is what I planned on using to define an SQL SELECT statement) <%@ Import Namespace="System.Data.OleDb" %><script runat="server">sub submit(sender As Object, e As System.EventArgs)dim dbconn,sqladd,dbcmd,sqlverif Page.IsValid then dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("Someplace.mdb")) dbconn.Open() sqladd="INSERT INTO TABLEName ([user])" sqladd=sqladd & " VALUES " sqladd=sqladd & "('" & Request.Form("User1") & "')" dbcmd=New OleDbCommand(sql,dbconn) dbcmd.ExecuteNonquery() dbconn.close() dbconn=Nothing AccountCreationlbl1.text="" AccountCreationlbl2.text="" server.transfer("AccountCreated.aspx", true) else If City1check.IsValid=False or State1Check.IsValid=False or Zip1check1.IsValid=False or Zip1Check2.IsValid=False then BillAddylbl1.text="<table cellpadding=0 border=1 width=100%><tr>" BillAddylbl2.text="</tr></table>" End If AccountCreationlbl1.text="<font face=arial color=red size=3><center>ALL FIELDS ARE REQUIRED. PLEASE CORRECT THE ERRORS.</center></font>" AccountCreationlbl2.text="<br><font face=arial color=red size=3><center>ALL FIELDS ARE REQUIRED. PLEASE CORRECT THE ERRORS.</center></font>"end ifend sub</script><html>
×
×
  • Create New...