By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,695 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,695 IT Pros & Developers. It's quick & easy.

Literal control combined with linkbuttons question

P: n/a
I'm adapting some code that wrote out html pages to work in dotnet and
be dynamic rather than static. Currently, a page is presented with a
table containing quite a few rows and columns. One of those columns is
a short description of the item. If there is extended information for
the item, the text is a hyperlink to a static webpage.

I found that the Literal control works great for just writing out the
table, but slipping a linkbutton in there in order to create the
detail page on the fly is tricky and perhaps not possible. I viewed
the source of pages with linkbuttons and can now create the necessary
html code and I can even get it to call an event handler (by using one
real linkbutton). But, there is no way to get a unique commandname or
other distinguishing property so I can't tell what linkbutton was
pressed. That data is not passed to the html/javascript and must be
stored in the project dll.

This is how I'm stuffing the linkbutton into the page. Note that q is
chr(34), a quote character:

DescField = "<a id=" & q & "LinkButton" & Links.ToString & q & "
href=" & q & "javascript:__doPostBack('LinkButton1','')" & q & ">" &
myRS.Item("RDesc").ToString & "</a>"

So, is there a way to make this work?

I could fall back to the static html pages that I used before because
slipping in a hyperlink is easy. But that wouldn't be very elegant. I
can also redo the whole thing and use a datagrid, datalist, or
repeater but I don't think I could be as flexible as I am just writing
the code myself. I'll probably do that just to see how it works. But,
I'm just being a bit stubborn and was wondering what could be done to
stuff the required info into the javascript or dll.
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.