Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Saturday, March 31, 2012

server side control not visible in webpage

Hey there-
I have a newbie question regarding code behind:
Using inline code, I can run a simple page that binds data to a
datagrid. Now, I try to take the same code and use code behind, and
the page compiles fine, but no HTML is rendered to the page.
Here is the code from "WebForm1.aspx"
<%@dotnet.itags.org. Page Language="vb" Inherits="WebForm1" src="http://pics.10026.com/?src=WebForm1.aspx.vb" %>
<html>
<head>
<title>WebForm1</title>
</head>
<body>
<asp:datagrid id="datGrid" runat="server"/>
</body>
</html>
--
And here is the code for "WebForm1.aspx.vb"
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Public Class WebForm1
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
BindData()
End Sub
Sub BindData()
'1. Create a connection
Dim AccessConn As System.Data.OleDb.OleDbConnection
Dim AccessCommand As System.Data.OleDb.OleDbCommand
Dim AccessReader As System.Data.OleDb.OleDbDataReader
Dim strConn As String
Dim datGrid As New DataGrid
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\inetpub\wwwroot\AddressBook\da
tabase\Address.mdb;"
AccessConn = New System.Data.OleDb.OleDbConnection(strConn)
'2. Create the command object, passing in the SQL string
Const strSQL As String = "SELECT ID, LastName, FirstName FROM
tblAddress ORDER BY LastName"
Dim myCommand As New System.Data.OleDb.OleDbCommand(strSQL,
AccessConn)
'Set the datagrid's datasource to the datareader and databind
AccessConn.Open()
datGrid.DataSource =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
datGrid.DataBind()
End Sub
End Class
--
A couple of notes:
1) I removed the "Web Form Designer Generated Code" for simplicity
2) Why do I need to declare datGrid? None of the examples I have seen
don't declare the server controls.
Regards,
ChristianChristian,

> 1) I removed the "Web Form Designer Generated Code" for simplicity
Don't do that! JK! I would suggest trying your example with the web form des
igner code cause your datagrid object is initialized in there. Also make sur
e your query is returning rows.
-Calvin Luttrell
ProjectThunder.com
Calvin-
I didn't remove the code from the actual aspx file, just in the
example here. My query is returning rows. Like I mentioned in the
previous post, everything works great if I use inline code, it's when
I modify it to code behind that the control doesn't render.
Christian
"Calvin Luttrell/ProjectThunder.com" <calvinl@.projectthunder.com> wrote in message news:<Ov
6WqlUQEHA.2520@.TK2MSFTNGP11.phx.gbl>...
> Christian,
>
> Don't do that! JK! I would suggest trying your example with the web form
> designer code cause your datagrid object is initialized in there. Also
> make sure your query is returning rows.
>
> -Calvin Luttrell
> ProjectThunder.com
>
>
>
>
> --

server side control not visible in webpage

Hey there-

I have a newbie question regarding code behind:

Using inline code, I can run a simple page that binds data to a
datagrid. Now, I try to take the same code and use code behind, and
the page compiles fine, but no HTML is rendered to the page.

Here is the code from "WebForm1.aspx"

------
<%@dotnet.itags.org. Page Language="vb" Inherits="WebForm1" src="http://pics.10026.com/?src=WebForm1.aspx.vb" %>
<html>
<head>
<title>WebForm1</title>
</head>
<body
<asp:datagrid id="datGrid" runat="server"/
</body>
</html>
-------

And here is the code for "WebForm1.aspx.vb"

-------
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data

Public Class WebForm1
Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
BindData()
End Sub

Sub BindData()

'1. Create a connection
Dim AccessConn As System.Data.OleDb.OleDbConnection
Dim AccessCommand As System.Data.OleDb.OleDbCommand
Dim AccessReader As System.Data.OleDb.OleDbDataReader
Dim strConn As String
Dim datGrid As New DataGrid

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\inetpub\wwwroot\AddressBook\database\Add ress.mdb;"
AccessConn = New System.Data.OleDb.OleDbConnection(strConn)

'2. Create the command object, passing in the SQL string
Const strSQL As String = "SELECT ID, LastName, FirstName FROM
tblAddress ORDER BY LastName"
Dim myCommand As New System.Data.OleDb.OleDbCommand(strSQL,
AccessConn)

'Set the datagrid's datasource to the datareader and databind
AccessConn.Open()
datGrid.DataSource =
myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
datGrid.DataBind()
End Sub

End Class
-------

A couple of notes:

1) I removed the "Web Form Designer Generated Code" for simplicity
2) Why do I need to declare datGrid? None of the examples I have seen
don't declare the server controls.

Regards,

ChristianChristian,

> 1) I removed the "Web Form Designer Generated Code" for simplicity

Don't do that! JK! I would suggest trying your example with the web form designer code cause your datagrid object is initialized in there. Also make sure your query is returning rows.

-Calvin Luttrell
ProjectThunder.com


Calvin-

I didn't remove the code from the actual aspx file, just in the
example here. My query is returning rows. Like I mentioned in the
previous post, everything works great if I use inline code, it's when
I modify it to code behind that the control doesn't render.

Christian

"Calvin Luttrell/ProjectThunder.com" <calvinl@.projectthunder.com> wrote in message news:<Ov6WqlUQEHA.2520@.TK2MSFTNGP11.phx.gbl>...
> Christian,
> > 1) I removed the "Web Form Designer Generated Code" for simplicity
> Don't do that! JK! I would suggest trying your example with the web form
> designer code cause your datagrid object is initialized in there. Also
> make sure your query is returning rows.
>
> -Calvin Luttrell
> ProjectThunder.com
>
>
>
>
> --

Server side control that maintains viewstate for client-side javascript variables?

I have some client-side javascript for that I use for dhtml stuff such as
hiding div tags based on user menu selections, etc. I need a way to maintain
the state of javascript variables across postback. Are there any server side
controls that can be used as a container for client-side javascript
variables? If not, how do other developers approach this issue?

Thanks,

Keihtjust use hidden fields

-- bruce (sqlwork.com)

Keithb wrote:

Quote:

Originally Posted by

I have some client-side javascript for that I use for dhtml stuff such as
hiding div tags based on user menu selections, etc. I need a way to maintain
the state of javascript variables across postback. Are there any server side
controls that can be used as a container for client-side javascript
variables? If not, how do other developers approach this issue?
>
Thanks,
>
Keiht
>
>

Server Side FieldSet?

I'm trying to write a Web Custom control that allows me to generate a set of server side text boxes inside the fieldset element. What I have is this:

protectedoverridevoid Render(HtmlTextWriter output)

{

StringBuilder sb =new StringBuilder();

//Begin the FieldSet if it's needed

if (this.ShowBorder )

sb.Append(string.Format("<fieldset style='WIDTH: {0}; HEIGHT: {1}'><legend>{2}</legend>",this.Width,this.Height,this.Legend));

//Add user controls

for(int i = 0; i <this.SearchFormFields.Length; i++)

{

SearchField curField =this.SearchFormFields[i];sb.Append(string.Format("<span class='fwifont'>{0}</span><br>", curField.Title));

//sb.Append(string.Format("<FWI:MultiRangeTextBox CssClass='fwifont' id=AccountNumberBox runat='server' TermName='{0}'></FWI:MultiRangeTextBox>", curField.TermName));

sb.Append("<asp:TextBox Runat='server' ID='fsdfd'></asp:TextBox>");

}

sb.Append("<br>");

//Finish off fieldset

if (this.ShowBorder )

sb.Append("</fieldset>");

sb.Append("<br>");

output.Write(sb.ToString());

}

However, the asp:text box does not render or show up. I'm guessing this has something to do with the fact that it's a server side control itself. Does anyone have any ideas on what I'm doing wrong here?

You are trying to output ASP control tags as markup. Would something like "<input type="text" id=......" rather the the ASP textbox control be more suitable?

Ta


Most unfortuantely, no, I cannot use html input fields. And actually, it not only needs to be a server side control, in reality it should be a custom web control that actually extends the asp:textbox class. I have a method that traverses all the controls on the web forms and handles the input of each textbox based on what "type" of server side text box it is.

Server side HTML printing

Hi,
I am using a rich text editor (FCKEdit) on a webpage in which user can
enter formatted text.
The output of this control is HTML. Now on the code behind side, I need
to change some of this HTML and then print the HTML (the pretty
document - not the code) on the server printer.
Any ideas'
Thanks in advance<sprash25@.gmail.com> wrote in message
news:1149837637.843058.67720@.i39g2000cwa.googlegroups.com...
> Hi,
> I am using a rich text editor (FCKEdit) on a webpage in which user can
> enter formatted text.
> The output of this control is HTML. Now on the code behind side, I need
> to change some of this HTML and then print the HTML (the pretty
> document - not the code) on the server printer.
> Any ideas'
> Thanks in advance
>
Well, I can help you with the capture of the html side. The printing is
another matter. This code will capture the html just before it get sent to
the client. You also google for 'asp.net output html save'
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
Dim _stringBuilder As StringBuilder = New StringBuilder()
Dim _stringWriter As StringWriter = New StringWriter(_stringBuilder)
Dim _htmlWriter As HtmlTextWriter = New HtmlTextWriter(_stringWriter)
MyBase.Render(_htmlWriter)
Dim html As String = _stringBuilder.ToString()
'here is where you can manipulate or save to file or database or maybe print
the html output string
writer.Write(html) 'this writes the page back out
End Sub
Mike

Server side HTML printing

Hi,

I am using a rich text editor (FCKEdit) on a webpage in which user can
enter formatted text.
The output of this control is HTML. Now on the code behind side, I need
to change some of this HTML and then print the HTML (the pretty
document - not the code) on the server printer.

Any ideas??

Thanks in advance<sprash25@.gmail.com> wrote in message
news:1149837637.843058.67720@.i39g2000cwa.googlegro ups.com...
> Hi,
> I am using a rich text editor (FCKEdit) on a webpage in which user can
> enter formatted text.
> The output of this control is HTML. Now on the code behind side, I need
> to change some of this HTML and then print the HTML (the pretty
> document - not the code) on the server printer.
> Any ideas??
> Thanks in advance
Well, I can help you with the capture of the html side. The printing is
another matter. This code will capture the html just before it get sent to
the client. You also google for 'asp.net output html save'

Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)

Dim _stringBuilder As StringBuilder = New StringBuilder()
Dim _stringWriter As StringWriter = New StringWriter(_stringBuilder)
Dim _htmlWriter As HtmlTextWriter = New HtmlTextWriter(_stringWriter)
MyBase.Render(_htmlWriter)

Dim html As String = _stringBuilder.ToString()

'here is where you can manipulate or save to file or database or maybe print
the html output string

writer.Write(html) 'this writes the page back out

End Sub

Mike

server side include or user control?

I am setting up an asp.net site using the Ektron CMS. Every page in the
site uses the same basic template, with the look of the page changing
via CSS and an id on the body. The id is shared by all pages in a
subsection, e.g. everything in /about/ needs to have <body id="about">.
In the past what I've done is set a global variable in index.asp, then
include the template to render the page:
<%
pageid = "about"
defaultcontentid = 33
%>
<!--#include virtual="/include/mastertemplate.asp" -->
mastertemplate.asp would be the entire page, echoing and processing the
variables like so:
<!--#include virtual="/include/cmsfunctions.asp" -->
<body id="<%= pageid %>">
<%= cmsRenderContent(defaultcontentid) %>
This worked great. I needed one index.asp for each subsection, and had
no duplication of template code. If the template needed to be updated, I
just gave it to the designer, who modified it in Dreamweaver or
whatever. The separation between presentation and logic was good, and
any code that generated html was in an easily-modified function.
I've experimented with a similar approach in asp.net, and have the start
of it working, but the additional complication is that
mastertemplate.aspx has some codebehind related to the cms server
controls that it uses, and I need to use the passed-in variables within
that codebehind. For example, I'd establish a default content id in the
calling page, and if the mastertemplate.asp doesn't detect an id in the
url, it will use the default.
I am looking for examples of this approach in asp.net but I keep running
across advice to use user controls instead. But it seems like user
controls are used for parts of pages, not the page template itself. Is
that right? Can a user control contain server controls? How would I pass
variables from a "stub" calling page to the user control page? Can a
user control be modified in something like Dreamweaver?
Thanks,
markgenerally they are right.
You will typically put a "place holder" into the template and then replace
that "place holder" with content created from a control (.ascx file). the
content is injected into the position of the "place holder" by using the
page.loadcontrol method.
example:
--
...somewhere in your code
' Dynamically inject a signin login module into the page
'---
If Request.IsAuthenticated = False Then
LoginControl.Controls.Add(Page.LoadControl("~/SignIn.ascx"))
End If
... somewhere in your template
<asp:placeholder id="LoginControl" runat="server" />
"Mark" <mark12b@.yahoo.com> wrote in message
news:mark12b-F29D08.12133710052005@.news.isp.giganews.com...
>I am setting up an asp.net site using the Ektron CMS. Every page in the
> site uses the same basic template, with the look of the page changing
> via CSS and an id on the body. The id is shared by all pages in a
> subsection, e.g. everything in /about/ needs to have <body id="about">.
> In the past what I've done is set a global variable in index.asp, then
> include the template to render the page:
> <%
> pageid = "about"
> defaultcontentid = 33
> %>
> <!--#include virtual="/include/mastertemplate.asp" -->
> mastertemplate.asp would be the entire page, echoing and processing the
> variables like so:
> <!--#include virtual="/include/cmsfunctions.asp" -->
> <body id="<%= pageid %>">
> <%= cmsRenderContent(defaultcontentid) %>
> This worked great. I needed one index.asp for each subsection, and had
> no duplication of template code. If the template needed to be updated, I
> just gave it to the designer, who modified it in Dreamweaver or
> whatever. The separation between presentation and logic was good, and
> any code that generated html was in an easily-modified function.
> I've experimented with a similar approach in asp.net, and have the start
> of it working, but the additional complication is that
> mastertemplate.aspx has some codebehind related to the cms server
> controls that it uses, and I need to use the passed-in variables within
> that codebehind. For example, I'd establish a default content id in the
> calling page, and if the mastertemplate.asp doesn't detect an id in the
> url, it will use the default.
> I am looking for examples of this approach in asp.net but I keep running
> across advice to use user controls instead. But it seems like user
> controls are used for parts of pages, not the page template itself. Is
> that right? Can a user control contain server controls? How would I pass
> variables from a "stub" calling page to the user control page? Can a
> user control be modified in something like Dreamweaver?
> Thanks,
> --
> mark
Include files are old fashioned.
User controls are a better approach. Yes, they can contain any kind of
controls you'd like. You can create public properties, methods, and events
to facilitate communication between the user control and the page.
I agree with you that user controls do not fully achieve the "template"
functionality you s as gracefully as we'd all like, but the only great
solution is in ASP.NET 2.0 (due out later this year) which implements
"Master Pages".
Here's more info:
http://SteveOrr.net/faq/usercustom.aspx
http://www.c-sharpcorner.com/Code/2...MasterPages.asp
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Mark" <mark12b@.yahoo.com> wrote in message
news:mark12b-F29D08.12133710052005@.news.isp.giganews.com...
>I am setting up an asp.net site using the Ektron CMS. Every page in the
> site uses the same basic template, with the look of the page changing
> via CSS and an id on the body. The id is shared by all pages in a
> subsection, e.g. everything in /about/ needs to have <body id="about">.
> In the past what I've done is set a global variable in index.asp, then
> include the template to render the page:
> <%
> pageid = "about"
> defaultcontentid = 33
> %>
> <!--#include virtual="/include/mastertemplate.asp" -->
> mastertemplate.asp would be the entire page, echoing and processing the
> variables like so:
> <!--#include virtual="/include/cmsfunctions.asp" -->
> <body id="<%= pageid %>">
> <%= cmsRenderContent(defaultcontentid) %>
> This worked great. I needed one index.asp for each subsection, and had
> no duplication of template code. If the template needed to be updated, I
> just gave it to the designer, who modified it in Dreamweaver or
> whatever. The separation between presentation and logic was good, and
> any code that generated html was in an easily-modified function.
> I've experimented with a similar approach in asp.net, and have the start
> of it working, but the additional complication is that
> mastertemplate.aspx has some codebehind related to the cms server
> controls that it uses, and I need to use the passed-in variables within
> that codebehind. For example, I'd establish a default content id in the
> calling page, and if the mastertemplate.asp doesn't detect an id in the
> url, it will use the default.
> I am looking for examples of this approach in asp.net but I keep running
> across advice to use user controls instead. But it seems like user
> controls are used for parts of pages, not the page template itself. Is
> that right? Can a user control contain server controls? How would I pass
> variables from a "stub" calling page to the user control page? Can a
> user control be modified in something like Dreamweaver?
> Thanks,
> --
> mark
In article <#3rMAzZVFHA.3696@.TK2MSFTNGP10.phx.gbl>,
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote:

> I agree with you that user controls do not fully achieve the "template"
> functionality you s as gracefully as we'd all like, but the only great
> solution is in ASP.NET 2.0 (due out later this year) which implements
> "Master Pages".
> Here's more info:
> http://SteveOrr.net/faq/usercustom.aspx
> http://www.c-sharpcorner.com/Code/2...MasterPages.asp
Yes, Master Pages is most like what I was after. Now I am thinking about
just passing the section name in the url and have everything run through
a single page. Instead of
/about/index.aspx?id=123
/portfolio/index.aspx?id=456
I'll go
/index.aspx?s=about&id=123
/index.aspx?s=portfolio&id=456
This should work fine, especially since the cms has url aliasing.
Thnkas,
Yes, I've tried that approach before and it's not as easy as it might seem
at first.
Since everything is essentially a postback to the same page, this opens up
new hassles related to dynamically creating controls at runtime and managing
them all between postbacks and keeping them from conflicting with eachother
in various ways.
If you can, skip to ASP.NET 2.0 and use master pages. Otherwise I'd suggest
you use multiple pages with header and/or footer controls to help manage a
common look & feel.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Mark" <mark12b@.yahoo.com> wrote in message
news:mark12b-377F1D.14180810052005@.news.isp.giganews.com...
> In article <#3rMAzZVFHA.3696@.TK2MSFTNGP10.phx.gbl>,
> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote:
>
> Yes, Master Pages is most like what I was after. Now I am thinking about
> just passing the section name in the url and have everything run through
> a single page. Instead of
> /about/index.aspx?id=123
> /portfolio/index.aspx?id=456
> I'll go
> /index.aspx?s=about&id=123
> /index.aspx?s=portfolio&id=456
> This should work fine, especially since the cms has url aliasing.
> Thnkas,

server side include or user control?

I am setting up an asp.net site using the Ektron CMS. Every page in the
site uses the same basic template, with the look of the page changing
via CSS and an id on the body. The id is shared by all pages in a
subsection, e.g. everything in /about/ needs to have <body id="about">.

In the past what I've done is set a global variable in index.asp, then
include the template to render the page:

<%
pageid = "about"
defaultcontentid = 33
%>
<!--#include virtual="/include/mastertemplate.asp" --
mastertemplate.asp would be the entire page, echoing and processing the
variables like so:

<!--#include virtual="/include/cmsfunctions.asp" -->
<body id="<%= pageid %>">
<%= cmsRenderContent(defaultcontentid) %
This worked great. I needed one index.asp for each subsection, and had
no duplication of template code. If the template needed to be updated, I
just gave it to the designer, who modified it in Dreamweaver or
whatever. The separation between presentation and logic was good, and
any code that generated html was in an easily-modified function.

I've experimented with a similar approach in asp.net, and have the start
of it working, but the additional complication is that
mastertemplate.aspx has some codebehind related to the cms server
controls that it uses, and I need to use the passed-in variables within
that codebehind. For example, I'd establish a default content id in the
calling page, and if the mastertemplate.asp doesn't detect an id in the
url, it will use the default.

I am looking for examples of this approach in asp.net but I keep running
across advice to use user controls instead. But it seems like user
controls are used for parts of pages, not the page template itself. Is
that right? Can a user control contain server controls? How would I pass
variables from a "stub" calling page to the user control page? Can a
user control be modified in something like Dreamweaver?

Thanks,

--
markgenerally they are right.

You will typically put a "place holder" into the template and then replace
that "place holder" with content created from a control (.ascx file). the
content is injected into the position of the "place holder" by using the
page.loadcontrol method.

example:
--------
...somewhere in your code

' Dynamically inject a signin login module into the page
'---------------------
If Request.IsAuthenticated = False Then
LoginControl.Controls.Add(Page.LoadControl("~/SignIn.ascx"))
End If

.... somewhere in your template

<asp:placeholder id="LoginControl" runat="server" /
"Mark" <mark12b@.yahoo.com> wrote in message
news:mark12b-F29D08.12133710052005@.news.isp.giganews.com...
>I am setting up an asp.net site using the Ektron CMS. Every page in the
> site uses the same basic template, with the look of the page changing
> via CSS and an id on the body. The id is shared by all pages in a
> subsection, e.g. everything in /about/ needs to have <body id="about">.
> In the past what I've done is set a global variable in index.asp, then
> include the template to render the page:
> <%
> pageid = "about"
> defaultcontentid = 33
> %>
> <!--#include virtual="/include/mastertemplate.asp" -->
> mastertemplate.asp would be the entire page, echoing and processing the
> variables like so:
> <!--#include virtual="/include/cmsfunctions.asp" -->
> <body id="<%= pageid %>">
> <%= cmsRenderContent(defaultcontentid) %>
> This worked great. I needed one index.asp for each subsection, and had
> no duplication of template code. If the template needed to be updated, I
> just gave it to the designer, who modified it in Dreamweaver or
> whatever. The separation between presentation and logic was good, and
> any code that generated html was in an easily-modified function.
> I've experimented with a similar approach in asp.net, and have the start
> of it working, but the additional complication is that
> mastertemplate.aspx has some codebehind related to the cms server
> controls that it uses, and I need to use the passed-in variables within
> that codebehind. For example, I'd establish a default content id in the
> calling page, and if the mastertemplate.asp doesn't detect an id in the
> url, it will use the default.
> I am looking for examples of this approach in asp.net but I keep running
> across advice to use user controls instead. But it seems like user
> controls are used for parts of pages, not the page template itself. Is
> that right? Can a user control contain server controls? How would I pass
> variables from a "stub" calling page to the user control page? Can a
> user control be modified in something like Dreamweaver?
> Thanks,
> --
> mark
Include files are old fashioned.
User controls are a better approach. Yes, they can contain any kind of
controls you'd like. You can create public properties, methods, and events
to facilitate communication between the user control and the page.
I agree with you that user controls do not fully achieve the "template"
functionality you seek as gracefully as we'd all like, but the only great
solution is in ASP.NET 2.0 (due out later this year) which implements
"Master Pages".

Here's more info:
http://SteveOrr.net/faq/usercustom.aspx
http://www.c-sharpcorner.com/Code/2...MasterPages.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Mark" <mark12b@.yahoo.com> wrote in message
news:mark12b-F29D08.12133710052005@.news.isp.giganews.com...
>I am setting up an asp.net site using the Ektron CMS. Every page in the
> site uses the same basic template, with the look of the page changing
> via CSS and an id on the body. The id is shared by all pages in a
> subsection, e.g. everything in /about/ needs to have <body id="about">.
> In the past what I've done is set a global variable in index.asp, then
> include the template to render the page:
> <%
> pageid = "about"
> defaultcontentid = 33
> %>
> <!--#include virtual="/include/mastertemplate.asp" -->
> mastertemplate.asp would be the entire page, echoing and processing the
> variables like so:
> <!--#include virtual="/include/cmsfunctions.asp" -->
> <body id="<%= pageid %>">
> <%= cmsRenderContent(defaultcontentid) %>
> This worked great. I needed one index.asp for each subsection, and had
> no duplication of template code. If the template needed to be updated, I
> just gave it to the designer, who modified it in Dreamweaver or
> whatever. The separation between presentation and logic was good, and
> any code that generated html was in an easily-modified function.
> I've experimented with a similar approach in asp.net, and have the start
> of it working, but the additional complication is that
> mastertemplate.aspx has some codebehind related to the cms server
> controls that it uses, and I need to use the passed-in variables within
> that codebehind. For example, I'd establish a default content id in the
> calling page, and if the mastertemplate.asp doesn't detect an id in the
> url, it will use the default.
> I am looking for examples of this approach in asp.net but I keep running
> across advice to use user controls instead. But it seems like user
> controls are used for parts of pages, not the page template itself. Is
> that right? Can a user control contain server controls? How would I pass
> variables from a "stub" calling page to the user control page? Can a
> user control be modified in something like Dreamweaver?
> Thanks,
> --
> mark
In article <#3rMAzZVFHA.3696@.TK2MSFTNGP10.phx.gbl>,
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote:

> I agree with you that user controls do not fully achieve the "template"
> functionality you seek as gracefully as we'd all like, but the only great
> solution is in ASP.NET 2.0 (due out later this year) which implements
> "Master Pages".
> Here's more info:
> http://SteveOrr.net/faq/usercustom.aspx
> http://www.c-sharpcorner.com/Code/2...MasterPages.asp

Yes, Master Pages is most like what I was after. Now I am thinking about
just passing the section name in the url and have everything run through
a single page. Instead of

/about/index.aspx?id=123
/portfolio/index.aspx?id=456

I'll go

/index.aspx?s=about&id=123
/index.aspx?s=portfolio&id=456

This should work fine, especially since the cms has url aliasing.

Thnkas,
Yes, I've tried that approach before and it's not as easy as it might seem
at first.
Since everything is essentially a postback to the same page, this opens up
new hassles related to dynamically creating controls at runtime and managing
them all between postbacks and keeping them from conflicting with eachother
in various ways.
If you can, skip to ASP.NET 2.0 and use master pages. Otherwise I'd suggest
you use multiple pages with header and/or footer controls to help manage a
common look & feel.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Mark" <mark12b@.yahoo.com> wrote in message
news:mark12b-377F1D.14180810052005@.news.isp.giganews.com...
> In article <#3rMAzZVFHA.3696@.TK2MSFTNGP10.phx.gbl>,
> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote:
>> I agree with you that user controls do not fully achieve the "template"
>> functionality you seek as gracefully as we'd all like, but the only great
>> solution is in ASP.NET 2.0 (due out later this year) which implements
>> "Master Pages".
>>
>> Here's more info:
>> http://SteveOrr.net/faq/usercustom.aspx
>> http://www.c-sharpcorner.com/Code/2...MasterPages.asp
> Yes, Master Pages is most like what I was after. Now I am thinking about
> just passing the section name in the url and have everything run through
> a single page. Instead of
> /about/index.aspx?id=123
> /portfolio/index.aspx?id=456
> I'll go
> /index.aspx?s=about&id=123
> /index.aspx?s=portfolio&id=456
> This should work fine, especially since the cms has url aliasing.
> Thnkas,

Thursday, March 29, 2012

server side or client side page?

a page that contain a validation control and starting a storeProcedures when the user click on a button --is considered as a client side page or as a server side page?
it seems to me that in asp.net everthing is server side, where are the client side pages?
thanks

The sp is server side, but the validation can be on or the other, depending on how it's coded.
ASP.Net has it's validations, so it's server side when using them.
But you can also make validations via JavaScript, so that would be client side.
Zath


but the validation controls (like RequiredFiledValidator) is a client side validation...,isnt that right?

because i know that if any of the validators are found to be on error the submission of the form to the server is cancelled...
so is there something that is done on the client side in asp.net?
thanks for the help


ppl1 wrote:

but the validation controls (like RequiredFiledValidator) is a client side validation...,isnt that right?

because i know that if any of the validators are found to be on error the submission of the form to the server is cancelled...


Yes the RequiredFieldValidator does the client side validation

ppl1 wrote:


so is there something that is done on the client side in asp.net?
thanks for the help


You can do so many things on client side and you should do so many things on client side to minimize postbacks if possible. So what exactly is that you are asking. Usually you use javascript to do client side stuff..


ok...so lets go back to my first question-> a page that contain a validation control and starting a storeProcedures when the user click on a button --is considered as a client side page or as a server side page?

ppl1 wrote:

ok...so lets go back to my first question-> a page that contain a validation control and starting a storeProcedures when the user click on a button --is considered as a client side page or as a server side page?


A webpage physically is considered a client side output for the asp.net server side processing. Asp.net uses browser to show its output to the user in the form of a web page. So, a webpage is a client side entity. Server wouldnt know anything about it after it outputs the html into the browser. Now, when the user clicks on the button, the page gets postback to the server. In here there are several things that goes on. The event of user clicking the button will be a client side event, and the page postbacks and server does some processing in response to the user action, which is button click event.

ok thanks for the help
Hi ,
Answering your question, calling a Stored Procedure is a Server Side call.
A page can contain server as well as client side technologies.
Hope it helps
Shahram

Server Side Validation

Hello,
I have made a custom control for a text field. I have to do server side validation for it. I just want it to see if a password equals a given value, if not validation should fail.
Can someone provide me with some pseudo script as I am new to ASP.NET.
Thanks.In your custom control, create a public property (read only), "IsValidPassword". In IsValidPassword's get portion, check for whether txtPassword.Text equals your value. If it does, return true, else return false.

So it'd look something like

public bool IsValidPassword
{
get
{
if(txtPassword.Text == "mendhak")
{
return true;
}
else
{
return false;
}
}
}
Thanks for your answer. But some confusion still exists. I have the following code and it complies without error.

protected void validatePass_ServerValidate(object source, ServerValidateEventArgs args)
{
if (txtPass.Text != "Mohit")
{ validatePass.IsValid = false;
validatePass.ErrorMessage = "Wrong Password!";

}
else validatePass.IsValid = true;

}
}

But it does not generate an error message when the wrong password is entered. What do I have to do to get an error message to be generated as is is the case with the CLIENT SIDE controls I have made...

Thanks!
Aah, you could've just continued your questions together in this thread rather than create a new thread for it.

Now, you should use args.IsValid = false rather than the name of the validator itself.
Thank you!

That works

My program works as I want it to but I have a theoretical question. If I want an error message to display when args.IsValid = false, for it to be considered SERVER SIDE do I have to include it in my code as follows:

if (txtPass.Text != "Mohit")
{args.IsValid = false;
validatePass.Text = "*";
validatePass.ErrorMessage = "Wrong Password!";


}
else args.IsValid = true;

I ask since I can set the error message in the custom validator control but I am worried if I do, it will be considered server side. I am not sure hence I ask.
Thank you!

That works

My program works as I want it to but I have a theoretical question. If I want an error message to display when args.IsValid = false, for it to be considered SERVER SIDE do I have to include it in my code as follows:

if (txtPass.Text != "Mohit")
{args.IsValid = false;
validatePass.Text = "*";
validatePass.ErrorMessage = "Wrong Password!";


}
else args.IsValid = true;

I ask since I can set the error message in the custom validator control but I am worried if I do, it will be considered server side. I am not sure hence I ask.
I ask since I can set the error message in the custom validator control but I am worried if I do, it will be considered server side. I am not sure hence I ask.

I meant to say it would be considered CLIENT SIDE...;)
If I understand you correctly, which I probably don't, then you fear the .ErrorMessage property, right?

ErrorMessage and Text are properties of your validator. When you set them, the page will show the error message/text as your page is setup. Now, are you asking whether... actually... I don't understand your question. Try rephrasing it?
If I set up the properties for error message and text in the custom validator instead of setting them up in the function as I did, would my validation still be considered SERVER SIDE VALIDATION?
From a user perspective, yes... because the page posted back and then came back with the error message.

From a programmer's perspective, yes... because it's all in the codebehind.

You don't want it to be serverside validation... why?
I want it to be all server side validation.;)

That is why I was checking. This control is supposed to be server side vaidation only.
In that case, your question's been answered, yes?
Yup!

Thanks!

Server SIde Validation Issue

Hello,

I have several client side validation controls that cause an error message to be displayed in the validation summary control.

For one control, custom control, I am required to do SERVER SIDE VALIDATION.

I have the follwing code:

protected void validatePass_ServerValidate(object source, ServerValidateEventArgs args)
{
if (txtPass.Text != "Mohit")
{ validatePass.IsValid = false;
validatePass.ErrorMessage = "Wrong Password!";
}
else validatePass.IsValid = true;

}

When I enter the wrong password though I do not see the custom control generate any error message and I do not see any error message in the summary control either.

Any assisatance would be appreciated.When the wrong password is entered and the user submits the page, in the page load event or the button click event, do a check for if(Page.IsValid)
I appreciate your response.

I am afraid that I am a newbie and will need a little bit of help here.

Can you provide some pseudo code as to what I should do and can you please make any modifications to the code I provided if necessary.

Thanks!
Let's deal with this in a single thread, yeah?

http://www.vbforums.com/showthread.php?t=491694

(Since they're related questions)

Monday, March 26, 2012

Server Table Control where do we use it?

Does anybody know when do we use the table server control in asp.net 2.0

it seems hard to design staff with the server table control am i right?I only use them from server side code, if I want to create a table programmatically. I don't usually us them in my .aspx page. Sometimes I use the HtmlTable control when I wanted to dynamically hide the table from code-behind or add other control to it instead of using a placeholder.

If you use the Table control, it could use a specific adapter for render the correct output for the client that accesses the page. That could be one reason to use it.
I find it great to show and hide certain details in forms

like:

<asp:TableRow Visible="<%# User.IsInRole("Administrator") %
</asp:TableRow
Without haveing to rewrite any of my code behind logic
some accessibility features for disabled persons
(detection of browser)

Server tag not well formed error.

I have created a custom image control everything works fine. It renders in the browser fine.

But when I drop the control in the webform, set the properties, go to html view, then back to design view. I get a gray box where my custom control was that says "Error Creating Custom Control" and then a message of "Server Tag is not well formed".

Anyone know why this would happen?
Here is how it looks in HMTL view from within the IDE.

<JHA:JHAImageRollover id="JHAImageRollover1" onclick="http://www.google.com" runat="server" BaseImage="/common/images/btn_search.gif" RolloverImage="/common/images/btn_cancel.gif"></JHA:JHAImageRollover>Is there are <@.Register > tag on the top of the .aspx page that the control is on?

My guess is the page doesn't know anything about the control since its library is not registered with the page.

<%@. Register TagPrefix="jh1" Namespace="YourControlLibraryNamespace" Assembly="YourControlLibrary" %>
Got it fixed...strange though.

The TagPrefix in the page directive was "jha"
it was yelling because the control had "JHA"

go figure!?

Saturday, March 24, 2012

Server variables in ASP.NET Html code

Given i have some control which has an "ImageURL" property. If this property
is set, then the HTML code for the web control looks something like:
<mns:image id=MyImg runat=server ImageURL="images/somepath.jpg"></mns:image>
Given i have some server variable Session("AppRoot") which declares the full
path to the root of the application, for example
Session("AppRoot") = "http://www.someserver.com/myapp/"
Now is there any way i can put the AppRoot variable directly into the HTML
control for the mns:image control, rather than having to put code in the .vb
file to do something like
MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
Could i somehow do SOMEthing like:
<mns:image id=MyImg runat=server
ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
</mns:image>There are a number of things I don't understand.
1-
If this is your own server control, or you have access to the source, why
not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
class before the render? This way you don't have to worry about doing it
either at the page level or the codebehind. If you don't write your own
that inherits from this one.
2-
Does the AppRoot actually belong to the sesssion? it's specific to each
user?
3-
You can simply use ~ to denote the application root, ala:
ImageUrl="~/images/somepath.jpg"
4-
The answer to your question is no..but the solution in #1 will solve her
right up.
Karl
"A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> Given i have some control which has an "ImageURL" property. If this
property
> is set, then the HTML code for the web control looks something like:
> <mns:image id=MyImg runat=server
ImageURL="images/somepath.jpg"></mns:image>
> Given i have some server variable Session("AppRoot") which declares the
full
> path to the root of the application, for example
> Session("AppRoot") = "http://www.someserver.com/myapp/"
> Now is there any way i can put the AppRoot variable directly into the HTML
> control for the mns:image control, rather than having to put code in the
.vb
> file to do something like
> MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
> Could i somehow do SOMEthing like:
> <mns:image id=MyImg runat=server
> ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> </mns:image>
>
Well, i cannot code it into the code for the control, because the control is
made in a separate library meant ot be generic to NO app in specific.
I cannot use a Root path ("/" or "~") because the app does not root at the
root of the site.
The site's root is www.myserver.com/myapp, not www.myserver.com
Otherwise then i guess im just stuck having to alter the urls in the .vb
file then. Thats a little annoying. Itd be nice if you could somehow use
something like the databinding stuff to put out a server variable into
ASP.NET html code.
"Karl" <none> wrote in message news:e$mfDPTiEHA.1644@.tk2msftngp13.phx.gbl...
> There are a number of things I don't understand.
> 1-
> If this is your own server control, or you have access to the source, why
> not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
> class before the render? This way you don't have to worry about doing it
> either at the page level or the codebehind. If you don't write your own
> that inherits from this one.
> 2-
> Does the AppRoot actually belong to the sesssion? it's specific to each
> user?
> 3-
> You can simply use ~ to denote the application root, ala:
> ImageUrl="~/images/somepath.jpg"
> 4-
> The answer to your question is no..but the solution in #1 will solve her
> right up.
> Karl
> "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> property
> ImageURL="images/somepath.jpg"></mns:image>
> full
HTML
> .vb
>
~ uses the virtual app..so it should be ~ should be equal to /myapp
and you could still make the code generic to no specific app (as it is now
actually, it's specific to apps at the root level so it isn't very
generic)...but ~ should do the trick.
Karl
"A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:eqKHwWTiEHA.3536@.TK2MSFTNGP12.phx.gbl...
> Well, i cannot code it into the code for the control, because the control
is
> made in a separate library meant ot be generic to NO app in specific.
> I cannot use a Root path ("/" or "~") because the app does not root at the
> root of the site.
> The site's root is www.myserver.com/myapp, not www.myserver.com
> Otherwise then i guess im just stuck having to alter the urls in the .vb
> file then. Thats a little annoying. Itd be nice if you could somehow use
> something like the databinding stuff to put out a server variable into
> ASP.NET html code.
> "Karl" <none> wrote in message
news:e$mfDPTiEHA.1644@.tk2msftngp13.phx.gbl...
why
own
the
> HTML
the
>
Hmm, .. well, i tried using the ~ instead and taking out my code in .vb to
prepend the approot to the path, but it does not work with the ~.
Thanks though for the idea.
"Karl" <none> wrote in message news:OKTWrbTiEHA.1384@.TK2MSFTNGP10.phx.gbl...
> ~ uses the virtual app..so it should be ~ should be equal to /myapp
> and you could still make the code generic to no specific app (as it is now
> actually, it's specific to apps at the root level so it isn't very
> generic)...but ~ should do the trick.
> Karl
> "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:eqKHwWTiEHA.3536@.TK2MSFTNGP12.phx.gbl...
control
> is
the
> news:e$mfDPTiEHA.1644@.tk2msftngp13.phx.gbl...
> why
the
it
> own
each
her
> the
the
> the
>

Server variables in ASP.NET Html code

Given i have some control which has an "ImageURL" property. If this property
is set, then the HTML code for the web control looks something like:

<mns:image id=MyImg runat=server ImageURL="images/somepath.jpg"></mns:image
Given i have some server variable Session("AppRoot") which declares the full
path to the root of the application, for example
Session("AppRoot") = "http://www.someserver.com/myapp/"

Now is there any way i can put the AppRoot variable directly into the HTML
control for the mns:image control, rather than having to put code in the .vb
file to do something like
MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL

Could i somehow do SOMEthing like:

<mns:image id=MyImg runat=server
ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
</mns:imageThere are a number of things I don't understand.

1-
If this is your own server control, or you have access to the source, why
not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
class before the render? This way you don't have to worry about doing it
either at the page level or the codebehind. If you don't write your own
that inherits from this one.

2-
Does the AppRoot actually belong to the sesssion? it's specific to each
user?

3-
You can simply use ~ to denote the application root, ala:
ImageUrl="~/images/somepath.jpg"

4-
The answer to your question is no..but the solution in #1 will solve her
right up.

Karl

"A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> Given i have some control which has an "ImageURL" property. If this
property
> is set, then the HTML code for the web control looks something like:
> <mns:image id=MyImg runat=server
ImageURL="images/somepath.jpg"></mns:image>
> Given i have some server variable Session("AppRoot") which declares the
full
> path to the root of the application, for example
> Session("AppRoot") = "http://www.someserver.com/myapp/"
> Now is there any way i can put the AppRoot variable directly into the HTML
> control for the mns:image control, rather than having to put code in the
..vb
> file to do something like
> MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
> Could i somehow do SOMEthing like:
> <mns:image id=MyImg runat=server
> ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> </mns:image>
Well, i cannot code it into the code for the control, because the control is
made in a separate library meant ot be generic to NO app in specific.

I cannot use a Root path ("/" or "~") because the app does not root at the
root of the site.
The site's root is www.myserver.com/myapp, not www.myserver.com

Otherwise then i guess im just stuck having to alter the urls in the .vb
file then. Thats a little annoying. Itd be nice if you could somehow use
something like the databinding stuff to put out a server variable into
ASP.NET html code.

"Karl" <none> wrote in message news:e$mfDPTiEHA.1644@.tk2msftngp13.phx.gbl...
> There are a number of things I don't understand.
> 1-
> If this is your own server control, or you have access to the source, why
> not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
> class before the render? This way you don't have to worry about doing it
> either at the page level or the codebehind. If you don't write your own
> that inherits from this one.
> 2-
> Does the AppRoot actually belong to the sesssion? it's specific to each
> user?
> 3-
> You can simply use ~ to denote the application root, ala:
> ImageUrl="~/images/somepath.jpg"
> 4-
> The answer to your question is no..but the solution in #1 will solve her
> right up.
> Karl
> "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> > Given i have some control which has an "ImageURL" property. If this
> property
> > is set, then the HTML code for the web control looks something like:
> > <mns:image id=MyImg runat=server
> ImageURL="images/somepath.jpg"></mns:image>
> > Given i have some server variable Session("AppRoot") which declares the
> full
> > path to the root of the application, for example
> > Session("AppRoot") = "http://www.someserver.com/myapp/"
> > Now is there any way i can put the AppRoot variable directly into the
HTML
> > control for the mns:image control, rather than having to put code in the
> .vb
> > file to do something like
> > MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
> > Could i somehow do SOMEthing like:
> > <mns:image id=MyImg runat=server
> > ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> > </mns:image>
~ uses the virtual app..so it should be ~ should be equal to /myapp

and you could still make the code generic to no specific app (as it is now
actually, it's specific to apps at the root level so it isn't very
generic)...but ~ should do the trick.

Karl

"A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:eqKHwWTiEHA.3536@.TK2MSFTNGP12.phx.gbl...
> Well, i cannot code it into the code for the control, because the control
is
> made in a separate library meant ot be generic to NO app in specific.
> I cannot use a Root path ("/" or "~") because the app does not root at the
> root of the site.
> The site's root is www.myserver.com/myapp, not www.myserver.com
> Otherwise then i guess im just stuck having to alter the urls in the .vb
> file then. Thats a little annoying. Itd be nice if you could somehow use
> something like the databinding stuff to put out a server variable into
> ASP.NET html code.
> "Karl" <none> wrote in message
news:e$mfDPTiEHA.1644@.tk2msftngp13.phx.gbl...
> > There are a number of things I don't understand.
> > 1-
> > If this is your own server control, or you have access to the source,
why
> > not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
> > class before the render? This way you don't have to worry about doing it
> > either at the page level or the codebehind. If you don't write your
own
> > that inherits from this one.
> > 2-
> > Does the AppRoot actually belong to the sesssion? it's specific to each
> > user?
> > 3-
> > You can simply use ~ to denote the application root, ala:
> > ImageUrl="~/images/somepath.jpg"
> > 4-
> > The answer to your question is no..but the solution in #1 will solve her
> > right up.
> > Karl
> > "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> > news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> > > Given i have some control which has an "ImageURL" property. If this
> > property
> > > is set, then the HTML code for the web control looks something like:
> > > > <mns:image id=MyImg runat=server
> > ImageURL="images/somepath.jpg"></mns:image>
> > > > Given i have some server variable Session("AppRoot") which declares
the
> > full
> > > path to the root of the application, for example
> > > Session("AppRoot") = "http://www.someserver.com/myapp/"
> > > > Now is there any way i can put the AppRoot variable directly into the
> HTML
> > > control for the mns:image control, rather than having to put code in
the
> > .vb
> > > file to do something like
> > > MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
> > > > Could i somehow do SOMEthing like:
> > > > <mns:image id=MyImg runat=server
> > > ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> > > </mns:image>
> >
Hmm, .. well, i tried using the ~ instead and taking out my code in .vb to
prepend the approot to the path, but it does not work with the ~.

Thanks though for the idea.

"Karl" <none> wrote in message news:OKTWrbTiEHA.1384@.TK2MSFTNGP10.phx.gbl...
> ~ uses the virtual app..so it should be ~ should be equal to /myapp
> and you could still make the code generic to no specific app (as it is now
> actually, it's specific to apps at the root level so it isn't very
> generic)...but ~ should do the trick.
> Karl
> "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:eqKHwWTiEHA.3536@.TK2MSFTNGP12.phx.gbl...
> > Well, i cannot code it into the code for the control, because the
control
> is
> > made in a separate library meant ot be generic to NO app in specific.
> > I cannot use a Root path ("/" or "~") because the app does not root at
the
> > root of the site.
> > The site's root is www.myserver.com/myapp, not www.myserver.com
> > Otherwise then i guess im just stuck having to alter the urls in the .vb
> > file then. Thats a little annoying. Itd be nice if you could somehow use
> > something like the databinding stuff to put out a server variable into
> > ASP.NET html code.
> > "Karl" <none> wrote in message
> news:e$mfDPTiEHA.1644@.tk2msftngp13.phx.gbl...
> > > There are a number of things I don't understand.
> > > > 1-
> > > If this is your own server control, or you have access to the source,
> why
> > > not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in
the
> > > class before the render? This way you don't have to worry about doing
it
> > > either at the page level or the codebehind. If you don't write your
> own
> > > that inherits from this one.
> > > > 2-
> > > Does the AppRoot actually belong to the sesssion? it's specific to
each
> > > user?
> > > > 3-
> > > You can simply use ~ to denote the application root, ala:
> > > ImageUrl="~/images/somepath.jpg"
> > > > 4-
> > > The answer to your question is no..but the solution in #1 will solve
her
> > > right up.
> > > > Karl
> > > > "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> > > news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> > > > Given i have some control which has an "ImageURL" property. If this
> > > property
> > > > is set, then the HTML code for the web control looks something like:
> > > > > > <mns:image id=MyImg runat=server
> > > ImageURL="images/somepath.jpg"></mns:image>
> > > > > > Given i have some server variable Session("AppRoot") which declares
> the
> > > full
> > > > path to the root of the application, for example
> > > > Session("AppRoot") = "http://www.someserver.com/myapp/"
> > > > > > Now is there any way i can put the AppRoot variable directly into
the
> > HTML
> > > > control for the mns:image control, rather than having to put code in
> the
> > > .vb
> > > > file to do something like
> > > > MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
> > > > > > Could i somehow do SOMEthing like:
> > > > > > <mns:image id=MyImg runat=server
> > > > ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> > > > </mns:image>
> > > > > >