Showing posts with label empty. Show all posts
Showing posts with label empty. Show all posts

Saturday, March 24, 2012

Pass variable through include url

Well,
I have made a template which shows the header.
Now in an empty page I include it on the top and this way it shows when I query the page also the header.
This works.
Now I want in the header there is a cell which is empty to show a message.
This message is dynamic, so it depends on what you give as message.
I could it make that when I query index.aspx?message=test that in my header(header.aspx) it shows the message test.
Now want to do it this way.
I query index.aspx
but in index.aspx I do an include this way:
<!--#include file="template/header.aspx"-->
that I make it this way:
<!--#include file="template/header.aspx?message:test"-->
this way I can show on my header a message in that empty cell without the user seeing it in the url.
Is this possible?

Eeek...
You're really going about this a hard way.
If you aren't using 2.0 (which I'm assuming you aren't) then I'd create the header as a UserControl.
Then just plop it on the page. You can easily create a Public Property on the header then, that is accessible from the page, that you can set the Text to...

Friday, March 16, 2012

Passing a variable to HTML tag

Hi,

I'm creating a control to get the next and back page name. When I try to pass that name to the href tag in the HTML, the link is empty and I'm not sure what's wrong. I've checked the values with response.write so I know that the values are there. I've also defined the PageBack and PageNext variables outside the sub.


<%@dotnet.itags.org. Control Language="VB" %>
<script runat="server">
Dim PageBack as String
Dim PageNext as String

Sub Page_Load(sender As Object, e As EventArgs)
Dim strPageName = System.IO.Path.GetFileName(Request.Path)
Dim PageNumStart as Integer = strPageName.Indexof("P") +2
Dim PageNumEnd as Integer = strPageName.Indexof(".")+1
Dim PageNum as String = Mid(strPageName,PageNumStart,PageNumEnd-PageNumStart)
PageBack=Left(strPageName,PageNumStart-1)&PageNum-1 &".aspx"
PageNext=Left(strPageName,PageNumStart-1)&PageNum+1 &".aspx"
End Sub

</script>
Back<br>
Next

I've also tried the href with just the double quotes: ="<%# PageBack %>"
ThanksYou need to call DataBind() at the end of your Page_Load.
Thanks so much. I normally do but forgot it here.