You could redirect the user (in the javascript function) and add a querystring variable to indicate that the page has been loaded because of the call to the javascript function (you just check for the querstring on your Page_Load). e.g. something like:
Is there anyway progmarically I can do this in vb.net? Such as populating the litteral with a vb click event which triggers a set procedure in the code behind? Basically I mean just someway to capture an event (besides using JS).
I usualy use a datalist populted by my sproc and then use the CommandName and CommandValue options to pass the info I need into the datalist_itemcommand procedure in the code behind, but in this case I have a recursive call to create the data I want to display, basically a list of categories like this:
cat1
------>cat1.1
------------>cat1.1.1
------------>cat1.1.2
cat2
------>cat2.1
...and so on.
I've not found a way to bind that kind of view to a datalist or datagrid (at least not in a formatted way). I want each cat name to be a link which is captured by VB, in the datalist case that would be in the _ItemCommand procedure.
So, for now I am using a literal populated by HTML generated by my recursive procdure to display the categories in teh format above. I dont mind having to refresh the page (by passing a var in the QS as suggested), but I'm trying not to lose state as I have previous panels on the page which have data in a form I want to retain...
There is no click event associated with a literal control so the only way to do it would be add another control next to your literal control (or only have a Button or LinkButton).
I would suggest using a LinkButton instead of your literal control as you can set the text property to be whatever you want (i.e. you can include your HTML formatted text so it appears in the format you stated above) and it has an click event associated with it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.