Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hyperlink to refresh formview

Status
Not open for further replies.

EZEason

Programmer
Dec 11, 2000
213
US
Ok, I'm new to ASP.net, I'v been a vb programmer fo 7 years.

I have a table that is built on form load the show a schedule. The schedule is tide to a calendar control on the same form. When a new date is selecte the form does a PostBack and populates the table with the selected dates information. When the table is built during the post back it adds a hyperlink into the cells that have already been scheduled. I have a formview on this page also that I need to have it update(refeshed) when a link is clicked. How do I do this in ASP?

Jim

What doesn't kill you makes you stronger.
 
Just use a linkbutton and the page will refresh on itself anyway, then you can put any logic you want performed on that click in the event handler of the link control.

Rob

---------------------------------------
 
Maybe I'm not building the link correctly.
Code:
schcell(i).ID = rm & i
lnk.Attributes.Add("href", "javascript:__doPostBack('" & "Table2" & "','" & cid(i) & "')")
lnk.Text = str1(i - x)
schcell(i - x).Controls.Add(lnk)

I think this will create just a html link, not an asp linkbutton. Is there a better way to dynamiclly add a link?

What doesn't kill you makes you stronger.
 
schcell(i).ID = rm & i
lnk.Attributes.Add("href", "javascript:__doPostBack('" & "Table2" & "','" & cid(i) & "')")
lnk.Text = str1(i - x)
schcell(i - x).Controls.Add(lnk)
The sections I've highlighted in bold won't compile or work. You'll have to use FindControl if you want to get a reference to a control like that.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
That is a typeo, the first line should be schcell(i-x) = rm&i

It is correct in the code.

What doesn't kill you makes you stronger.
 
It still won't compile as you can't access controls like that.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
That is my question, what should I be using to create this link? The example was to show what was not working.

What doesn't kill you makes you stronger.
 
I'm not quite following here. How are you building the table and adding it to the page? Are you simply writing a string to a placeholder? Also if you are already able to display the hyperlinks then why can't you add the href to them?

Like

Dim table as string = "<table><tr><td><a href="whatever">Whatever</a></td></tr></table>"
Then output the string. Probably not the best way, but it will work. In fact I sometimes do this when doing ajax stuff for dynamic tables.
 
The table is built in vb on each page lode. When a user clicks a new date in the calendar control the page does a postback, and displays a new table. I clear the table and then run it threw a few fucntions to get the end result. During one of the functions the table has hyperlinks added into the cell.

What I do not know how to do is have a formview display the current data that matches a clicked link inside the table. The link contains the ID of the data to be displayed. I hope this clears up the mud.

What doesn't kill you makes you stronger.
 
I have never worked with a formview before, but hyperlinks are going to redirect you to a page, so, you could redirect to the same page except pass an extra (or a few) parameters through the querystring, then on the page load check for the parameters, if they exsist then you can display your formview contents. Not sure if that helps...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top