Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Thursday, March 29, 2012

Set Column Headertext

Hi
I have a Datagrid with a templatecolumn, where I add at design time. I also checked the "create columns automatically"
I would like to change the headertext of columns created automatically, but i don't know in which event I can do that

Can you help me

P.S. I tryied to set the headertext in the "PreRender" event of the DataGrid, but in this point the grid has still only the templatecolumn, and the others columns aren't created yet

Thank you
Alessandro RossHi, Alessandro Rossi,

If you extend the DataGrid class (inherit from it) the best place is the
OnDataBinding protected method. You should first call base.OnDataBinding(e);
of course.

If you are simply using the DataGrid class - set the headertexts after you
call DataBind() because the columns are in fact created with this call.

Hope this helps
Martin
"Alessandro Rossi" <alessandro.rossi@.areait.net> wrote in message
news:528CD483-7F36-4D2A-8760-24CD36F0BE8A@.microsoft.com...
> Hi,
> I have a Datagrid with a templatecolumn, where I add at design time. I
also checked the "create columns automatically".
> I would like to change the headertext of columns created automatically,
but i don't know in which event I can do that.
> Can you help me?
> P.S. I tryied to set the headertext in the "PreRender" event of the
DataGrid, but in this point the grid has still only the templatecolumn, and
the others columns aren't created yet.
> Thank you.
> Alessandro Rossi

Monday, March 26, 2012

set default login name

i want to set the default login name for user, i.e. each time the user use
the application, the login name would be displayed in advance and user only
need to input the password. how to do that'
million thanks..That depends, is this user creating an account.
Does the username exists already.
Is the username the same for all users or different for each user.
I'm assuming that the user has already got an account, and returning to the
site.
The way you can make the site remember a user is with cookies.
You set the cookie when the user logs in. Then whenever the page loads, it
looks of that cookie exists and if so, sets the users username in the
username textbox
"Grey" <erickwyum@.i-cable.com> wrote in message
news:%234sQC77nEHA.2808@.TK2MSFTNGP10.phx.gbl...
>i want to set the default login name for user, i.e. each time the user use
> the application, the login name would be displayed in advance and user
> only
> need to input the password. how to do that'
> million thanks..
>

Set default Tag Prefix and CSS?

Hello,
I am creating a web server control derived from
datagrid for the first time. Now I would like to set the
prefix of my control by default to SK instead of CC1. Is
that possible? The other question is that my datagrid
should use a default stylesheet. I have set the cssclass
property of all items which I want to change. BUT I am not
setting the link tag in the head section to my css. I dont
want to do that. I would like to do that direclty in my
component. Is that possible?
ThanksAlternatingItemStyle
ItemStyle
HeaderStyle
footerstyle
if u set css for these four element, css will apply for u're componet. plz
see blow , I explained how we hve to use sample class...
<asp:datagrid id="dgActivity" runat="server" AllowPaging="True"
Class="DataGridStyle" Width="100%"
CellPadding="2" PageSize="30" AutoGenerateColumns="False" AllowSorting="True
">
<AlternatingItemStyle
CssClass="DataGridAlterItemStyle"></AlternatingItemStyle>
<ItemStyle CssClass="DataGridItemStyle"></ItemStyle>
<HeaderStyle CssClass="DataGridHeaderStyle"></HeaderStyle>
.DataGridStyle
{
border-color : White;
border-style : solid;
}
.DataGridStyle td
{
border-color : White;
border-style : solid;
}
.DataGridHeaderStyle
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
.DataGridHeaderStyle a
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
.DataGridHeaderStyle a:link
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
.DataGridHeaderStyle a:hover
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
.DataGridHeaderStyle a:visited
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
"SK" wrote:

> Hello,
> I am creating a web server control derived from
> datagrid for the first time. Now I would like to set the
> prefix of my control by default to SK instead of CC1. Is
> that possible? The other question is that my datagrid
> should use a default stylesheet. I have set the cssclass
> property of all items which I want to change. BUT I am not
> setting the link tag in the head section to my css. I dont
> want to do that. I would like to do that direclty in my
> component. Is that possible?
> Thanks
>
Hello SK,
Look at the [assembly:TagPrefix] attribute. You'll need to reference System.Web.UI,
if you're not already.
[assembly:TagPrefix("YourNamespace", "YourPrefix")]
Matt Berther
http://www.mattberther.com

> Hello,
> I am creating a web server control derived from datagrid for the
> first time. Now I would like to set the prefix of my control by
> default to SK instead of CC1. Is that possible? The other question is
> that my datagrid should use a default stylesheet. I have set the
> cssclass property of all items which I want to change. BUT I am not
> setting the link tag in the head section to my css. I dont want to do
> that. I would like to do that direclty in my component. Is that
> possible?
> Thanks
>

Set default Tag Prefix and CSS?

Hello,

I am creating a web server control derived from
datagrid for the first time. Now I would like to set the
prefix of my control by default to SK instead of CC1. Is
that possible? The other question is that my datagrid
should use a default stylesheet. I have set the cssclass
property of all items which I want to change. BUT I am not
setting the link tag in the head section to my css. I dont
want to do that. I would like to do that direclty in my
component. Is that possible?

ThanksAlternatingItemStyle
ItemStyle
HeaderStyle
footerstyle

if u set css for these four element, css will apply for u're componet. plz
see blow , I explained how we hve to use sample class...
<asp:datagrid id="dgActivity" runat="server" AllowPaging="True"
Class="DataGridStyle" Width="100%"
CellPadding="2" PageSize="30" AutoGenerateColumns="False" AllowSorting="True">
<AlternatingItemStyle
CssClass="DataGridAlterItemStyle"></AlternatingItemStyle>
<ItemStyle CssClass="DataGridItemStyle"></ItemStyle>
<HeaderStyle CssClass="DataGridHeaderStyle"></HeaderStyle
..DataGridStyle
{
border-color : White;
border-style : solid;
}
..DataGridStyle td
{
border-color : White;
border-style : solid;
}
..DataGridHeaderStyle
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";

}
..DataGridHeaderStyle a
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
..DataGridHeaderStyle a:link
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
..DataGridHeaderStyle a:hover
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
..DataGridHeaderStyle a:visited
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}

"SK" wrote:

> Hello,
> I am creating a web server control derived from
> datagrid for the first time. Now I would like to set the
> prefix of my control by default to SK instead of CC1. Is
> that possible? The other question is that my datagrid
> should use a default stylesheet. I have set the cssclass
> property of all items which I want to change. BUT I am not
> setting the link tag in the head section to my css. I dont
> want to do that. I would like to do that direclty in my
> component. Is that possible?
> Thanks
Hello SK,

Look at the [assembly:TagPrefix] attribute. You'll need to reference System.Web.UI,
if you're not already.

[assembly:TagPrefix("YourNamespace", "YourPrefix")]

--
Matt Berther
http://www.mattberther.com

> Hello,
> I am creating a web server control derived from datagrid for the
> first time. Now I would like to set the prefix of my control by
> default to SK instead of CC1. Is that possible? The other question is
> that my datagrid should use a default stylesheet. I have set the
> cssclass property of all items which I want to change. BUT I am not
> setting the link tag in the head section to my css. I dont want to do
> that. I would like to do that direclty in my component. Is that
> possible?
> Thanks

set Expires tag for images?

Hi - I want to reduce the download time of various pages by setting the
'Expires' tag for various images to a future date (this will then stop the
browser from re-requesting these for each new session).

I'm hosting on a commercial service so I don't have direct access to IIS
configuration. Is there anyway I can control this from my server-side code?

Thanks,

Paul.Paul W wrote:

> Hi - I want to reduce the download time of various pages by setting
> the 'Expires' tag for various images to a future date (this will then
> stop the browser from re-requesting these for each new session).
> I'm hosting on a commercial service so I don't have direct access to
> IIS configuration. Is there anyway I can control this from my
> server-side code?

Not if the images are served directly by IIS. Your ISP should be able
to change the server configuration to allow for caching.

BTW, you should prefer Cache-Control: max-age over Expires.

Cheers,
--
http://www.joergjooss.de
mailto:news-reply@.joergjooss.de
Currently the images ARE directly served by IIS. Can you point me to how
else I could do this so I can set the "Cache-Control: max-age"? Thanks,

Paul.
----
"Joerg Jooss" <news-reply@.joergjooss.de> wrote in message
news:xn0e3b26b6h8ll002@.msnews.microsoft.com...
> Paul W wrote:
>> Hi - I want to reduce the download time of various pages by setting
>> the 'Expires' tag for various images to a future date (this will then
>> stop the browser from re-requesting these for each new session).
>>
>> I'm hosting on a commercial service so I don't have direct access to
>> IIS configuration. Is there anyway I can control this from my
>> server-side code?
> Not if the images are served directly by IIS. Your ISP should be able
> to change the server configuration to allow for caching.
> BTW, you should prefer Cache-Control: max-age over Expires.
> Cheers,
> --
> http://www.joergjooss.de
> mailto:news-reply@.joergjooss.de
Paul W wrote:

> Currently the images ARE directly served by IIS. Can you point me to
> how else I could do this so I can set the "Cache-Control: max-age"?
> Thanks,

You could implemment a HttpHandler that serves your images, but this is
really a waste of time. Ask your service provider to change your IIS
configuration.

Cheers,
--
http://www.joergjooss.de
mailto:news-reply@.joergjooss.de

Thursday, March 22, 2012

Set html table width at run time (in code)

Hi
How can I get a html control in my code?
I have a html table that I want the width is defined in code at run time,
i.e., I have this table and I have a datagrid. This datagrid have a variable
width because the number of columns depends of something that I have (that
is not important for this). Now, what I want is that the html table have
always the same width of my datagrid because of alignment of both.
NOTE: I must have (and want) the datagrid width variable and not fixed
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
rucaset its attribute runat=server, but you'll probably still have problems
while tables align width depending on its content... You can hardly create
different tables with same width. The only chance is when content never
exceedes desired table (or better said cell) width.
RobertK
{ Clever? No just smart. }
"ruca" <ruuca@.iol.pt> wrote in message
news:e4d176wbEHA.3148@.TK2MSFTNGP10.phx.gbl...
> Hi
> How can I get a html control in my code?
> I have a html table that I want the width is defined in code at run time,
> i.e., I have this table and I have a datagrid. This datagrid have a
variable
> width because the number of columns depends of something that I have (that
> is not important for this). Now, what I want is that the html table have
> always the same width of my datagrid because of alignment of both.
> NOTE: I must have (and want) the datagrid width variable and not fixed
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
>
Thanks
Now, how can I get the widht value at run time of a datagrid?
I have this:
Dim dgPx As Unit
dgPx = myDataGrid.Width()
But dgPx.Value does not have the value of the grid after binding grid.
Can you help?
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
"Robert Koritnik" <robert.koritnik.removethis@.avtenta.si> escreveu na
mensagem news:%23hnurAxbEHA.2816@.TK2MSFTNGP11.phx.gbl...
> set its attribute runat=server, but you'll probably still have problems
> while tables align width depending on its content... You can hardly create
> different tables with same width. The only chance is when content never
> exceedes desired table (or better said cell) width.
> --
> RobertK
> { Clever? No just smart. }
> "ruca" <ruuca@.iol.pt> wrote in message
> news:e4d176wbEHA.3148@.TK2MSFTNGP10.phx.gbl...
time,
> variable
(that
>
You will have to set that. I told you in my first answer this is a tough
one. The best suggestion I could give you is to put both (table and
Datagrid) inside another table set both control's width to 100%. They would
perfectly align and everything will depend on the width of the containing
table cell.
And you probably won't have to wory about widths of both parts of the
page... Or better said tables, while a datagris is also a table.
RobertK
{ Clever? No just smart. }
"ruca" <ruuca@.iol.pt> wrote in message
news:ekMCZTxbEHA.1048@.tk2msftngp13.phx.gbl...
> Thanks
> Now, how can I get the widht value at run time of a datagrid?
> I have this:
> Dim dgPx As Unit
> dgPx = myDataGrid.Width()
> But dgPx.Value does not have the value of the grid after binding grid.
> Can you help?
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
> "Robert Koritnik" <robert.koritnik.removethis@.avtenta.si> escreveu na
> mensagem news:%23hnurAxbEHA.2816@.TK2MSFTNGP11.phx.gbl...
create
> time,
> (that
have
>
One doesn't do this sort of things in the code. Put both the table and the
grid in another table as it's been suggested in another reply.
Eliyahu
"ruca" <ruuca@.iol.pt> wrote in message
news:e4d176wbEHA.3148@.TK2MSFTNGP10.phx.gbl...
> Hi
> How can I get a html control in my code?
> I have a html table that I want the width is defined in code at run time,
> i.e., I have this table and I have a datagrid. This datagrid have a
variable
> width because the number of columns depends of something that I have (that
> is not important for this). Now, what I want is that the html table have
> always the same width of my datagrid because of alignment of both.
> NOTE: I must have (and want) the datagrid width variable and not fixed
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
>

Set html table width at run time (in code)

Hi

How can I get a html control in my code?
I have a html table that I want the width is defined in code at run time,
i.e., I have this table and I have a datagrid. This datagrid have a variable
width because the number of columns depends of something that I have (that
is not important for this). Now, what I want is that the html table have
always the same width of my datagrid because of alignment of both.

NOTE: I must have (and want) the datagrid width variable and not fixed

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
rucaset its attribute runat=server, but you'll probably still have problems
while tables align width depending on its content... You can hardly create
different tables with same width. The only chance is when content never
exceedes desired table (or better said cell) width.

--
RobertK
{ Clever? No just smart. }

"ruca" <ruuca@.iol.pt> wrote in message
news:e4d176wbEHA.3148@.TK2MSFTNGP10.phx.gbl...
> Hi
> How can I get a html control in my code?
> I have a html table that I want the width is defined in code at run time,
> i.e., I have this table and I have a datagrid. This datagrid have a
variable
> width because the number of columns depends of something that I have (that
> is not important for this). Now, what I want is that the html table have
> always the same width of my datagrid because of alignment of both.
> NOTE: I must have (and want) the datagrid width variable and not fixed
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
Thanks
Now, how can I get the widht value at run time of a datagrid?

I have this:
Dim dgPx As Unit
dgPx = myDataGrid.Width()

But dgPx.Value does not have the value of the grid after binding grid.
Can you help?

--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"Robert Koritnik" <robert.koritnik.removethis@.avtenta.si> escreveu na
mensagem news:%23hnurAxbEHA.2816@.TK2MSFTNGP11.phx.gbl...
> set its attribute runat=server, but you'll probably still have problems
> while tables align width depending on its content... You can hardly create
> different tables with same width. The only chance is when content never
> exceedes desired table (or better said cell) width.
> --
> RobertK
> { Clever? No just smart. }
> "ruca" <ruuca@.iol.pt> wrote in message
> news:e4d176wbEHA.3148@.TK2MSFTNGP10.phx.gbl...
> > Hi
> > How can I get a html control in my code?
> > I have a html table that I want the width is defined in code at run
time,
> > i.e., I have this table and I have a datagrid. This datagrid have a
> variable
> > width because the number of columns depends of something that I have
(that
> > is not important for this). Now, what I want is that the html table have
> > always the same width of my datagrid because of alignment of both.
> > NOTE: I must have (and want) the datagrid width variable and not fixed
> > --
> > Programming ASP.NET with VB.NET
> > Thank's (if you try to help me)
> > Hope this help you (if I try to help you)
> > ruca
You will have to set that. I told you in my first answer this is a tough
one. The best suggestion I could give you is to put both (table and
Datagrid) inside another table set both control's width to 100%. They would
perfectly align and everything will depend on the width of the containing
table cell.

And you probably won't have to wory about widths of both parts of the
page... Or better said tables, while a datagris is also a table.

--
RobertK
{ Clever? No just smart. }

"ruca" <ruuca@.iol.pt> wrote in message
news:ekMCZTxbEHA.1048@.tk2msftngp13.phx.gbl...
> Thanks
> Now, how can I get the widht value at run time of a datagrid?
> I have this:
> Dim dgPx As Unit
> dgPx = myDataGrid.Width()
> But dgPx.Value does not have the value of the grid after binding grid.
> Can you help?
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
> "Robert Koritnik" <robert.koritnik.removethis@.avtenta.si> escreveu na
> mensagem news:%23hnurAxbEHA.2816@.TK2MSFTNGP11.phx.gbl...
> > set its attribute runat=server, but you'll probably still have problems
> > while tables align width depending on its content... You can hardly
create
> > different tables with same width. The only chance is when content never
> > exceedes desired table (or better said cell) width.
> > --
> > RobertK
> > { Clever? No just smart. }
> > "ruca" <ruuca@.iol.pt> wrote in message
> > news:e4d176wbEHA.3148@.TK2MSFTNGP10.phx.gbl...
> > > Hi
> > > > How can I get a html control in my code?
> > > I have a html table that I want the width is defined in code at run
> time,
> > > i.e., I have this table and I have a datagrid. This datagrid have a
> > variable
> > > width because the number of columns depends of something that I have
> (that
> > > is not important for this). Now, what I want is that the html table
have
> > > always the same width of my datagrid because of alignment of both.
> > > > NOTE: I must have (and want) the datagrid width variable and not fixed
> > > > > --
> > > Programming ASP.NET with VB.NET
> > > Thank's (if you try to help me)
> > > Hope this help you (if I try to help you)
> > > ruca
> >
One doesn't do this sort of things in the code. Put both the table and the
grid in another table as it's been suggested in another reply.

Eliyahu

"ruca" <ruuca@.iol.pt> wrote in message
news:e4d176wbEHA.3148@.TK2MSFTNGP10.phx.gbl...
> Hi
> How can I get a html control in my code?
> I have a html table that I want the width is defined in code at run time,
> i.e., I have this table and I have a datagrid. This datagrid have a
variable
> width because the number of columns depends of something that I have (that
> is not important for this). Now, what I want is that the html table have
> always the same width of my datagrid because of alignment of both.
> NOTE: I must have (and want) the datagrid width variable and not fixed
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca

set index of drop downbox

Hi,

I would like to set the selected item of drop downbox to the index of an
item that will only be known at run time.

I realise that if I were to know it at design time I could write

ddlResidentialCity.SelectedIndex = 3

however what I wish to do is say

ddlResidentialCity.SelectedIndex = Set to value of item who's text value is
"martin"

what I am unsure about is how to get the index of the item I wish to use as
the selected index

any help would be appreciated.

cheers

martinH

ddlResidentalCity.Items.FindByValue("martin").Selected = True
How about this?

ddlResidentialCity.SelectedValue = "martin"

"martin" <Stuart_REMOVE_36@.yahoo.com> wrote in message news:<#N9fYmwQEHA.132@.TK2MSFTNGP09.phx.gbl>...
> Hi,
> I would like to set the selected item of drop downbox to the index of an
> item that will only be known at run time.
> I realise that if I were to know it at design time I could write
> ddlResidentialCity.SelectedIndex = 3
> however what I wish to do is say
> ddlResidentialCity.SelectedIndex = Set to value of item who's text value is
> "martin"
> what I am unsure about is how to get the index of the item I wish to use as
> the selected index
>
> any help would be appreciated.
> cheers
> martin

set index of drop downbox

Hi,
I would like to set the selected item of drop downbox to the index of an
item that will only be known at run time.
I realise that if I were to know it at design time I could write
ddlResidentialCity.SelectedIndex = 3
however what I wish to do is say
ddlResidentialCity.SelectedIndex = Set to value of item who's text value is
"martin"
what I am unsure about is how to get the index of the item I wish to use as
the selected index
any help would be appreciated.
cheers
martinHi
ddlResidentalCity.Items.FindByValue("martin").Selected = True
ddlResidentialCity.SelectedIndex = ddlResidentalCity.Items.IndexOf( ddlResid
entalCity.Items.FindByText("martin"))
How about this?
ddlResidentialCity.SelectedValue = "martin"
"martin" <Stuart_REMOVE_36@.yahoo.com> wrote in message news:<#N9fYmwQEHA.132@.TK2MSFTNGP09.p
hx.gbl>...
> Hi,
> I would like to set the selected item of drop downbox to the index of an
> item that will only be known at run time.
> I realise that if I were to know it at design time I could write
> ddlResidentialCity.SelectedIndex = 3
> however what I wish to do is say
> ddlResidentialCity.SelectedIndex = Set to value of item who's text value i
s
> "martin"
> what I am unsure about is how to get the index of the item I wish to use a
s
> the selected index
>
> any help would be appreciated.
> cheers
> martin

Set length of container

Hi to anyone out there that is taking the time to read this. I'm new to
..net and any help given is appreciated.

I am displaying a datalist on a page and I want to limit the length of
the returned container.dataitem that is displayed to 39 characters. How
do i do this in asp.net? I can do this in classic asp by using the
len() function, but i'm a bit stuck on how to do it in asp.net.

Thanks for any help you can give, my code is below.

========================================
'code behind creating list

Dim SQLdata As String
Dim dDS As New DataSet()
SQLdata = "SELECT id, pagedata FROM tblContent WHERE level6 =
'" & sLev6 & "'"
sConn = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=" &
dbPath & ";"

Dim myConnd As New OleDbConnection(sConn)
Dim myAdapterd As New OleDbDataAdapter(SQLdata, myConnd)
myConnd.Open()

Try
myAdapterd.Fill(dDS)
DLdata.DataSource = dDS.Tables(0).DefaultView
DLdata.DataBind()
Finally
myConnd.Close()
End Try

========================================
'code on aspx page displaying list

<asp:DataList ID="DLdata" runat="server" cssclass="DLdatagrid">
<ItemStyle CssClass="DLdata" />
<ItemTemplate>
<img src="http://pics.10026.com/?src=images/arrow.jpg" alt=""/> <a
href='pagedata.aspx?id=<%#DataBinder.Eval(Container.DataItem,
"id")%>'><%#DataBinder.Eval(Container.DataItem, "pagedata")%></a
</ItemTemplate>
</asp:DataListthe easiest way to do it is:

<%# left(DataBinder.Eval(Container.DataItem, "pagedata"), 39)%
Karl

--
http://www.openmymind.net/

<marcus.lecount@.googlemail.com> wrote in message
news:1138056537.361430.326800@.z14g2000cwz.googlegr oups.com...
> Hi to anyone out there that is taking the time to read this. I'm new to
> .net and any help given is appreciated.
> I am displaying a datalist on a page and I want to limit the length of
> the returned container.dataitem that is displayed to 39 characters. How
> do i do this in asp.net? I can do this in classic asp by using the
> len() function, but i'm a bit stuck on how to do it in asp.net.
> Thanks for any help you can give, my code is below.
> ========================================
> 'code behind creating list
> Dim SQLdata As String
> Dim dDS As New DataSet()
> SQLdata = "SELECT id, pagedata FROM tblContent WHERE level6 =
> '" & sLev6 & "'"
> sConn = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=" &
> dbPath & ";"
> Dim myConnd As New OleDbConnection(sConn)
> Dim myAdapterd As New OleDbDataAdapter(SQLdata, myConnd)
> myConnd.Open()
> Try
> myAdapterd.Fill(dDS)
> DLdata.DataSource = dDS.Tables(0).DefaultView
> DLdata.DataBind()
> Finally
> myConnd.Close()
> End Try
> ========================================
> 'code on aspx page displaying list
> <asp:DataList ID="DLdata" runat="server" cssclass="DLdatagrid">
> <ItemStyle CssClass="DLdata" />
> <ItemTemplate>
> <img src="http://pics.10026.com/?src=images/arrow.jpg" alt=""/> <a
> href='pagedata.aspx?id=<%#DataBinder.Eval(Container.DataItem,
> "id")%>'><%#DataBinder.Eval(Container.DataItem, "pagedata")%></a>
> </ItemTemplate>
> </asp:DataList
Thanks Karl, I can't believe i missed that. Why do i always miss the
obvious?
Thanks for taking the time to answer, I appreciate your help.

Karl Seguin [MVP] wrote:
> the easiest way to do it is:
> <%# left(DataBinder.Eval(Container.DataItem, "pagedata"), 39)%>
> Karl
> --
> http://www.openmymind.net/
>
> <marcus.lecount@.googlemail.com> wrote in message
> news:1138056537.361430.326800@.z14g2000cwz.googlegr oups.com...
> > Hi to anyone out there that is taking the time to read this. I'm new to
> > .net and any help given is appreciated.
> > I am displaying a datalist on a page and I want to limit the length of
> > the returned container.dataitem that is displayed to 39 characters. How
> > do i do this in asp.net? I can do this in classic asp by using the
> > len() function, but i'm a bit stuck on how to do it in asp.net.
> > Thanks for any help you can give, my code is below.
> > ========================================
> > 'code behind creating list
> > Dim SQLdata As String
> > Dim dDS As New DataSet()
> > SQLdata = "SELECT id, pagedata FROM tblContent WHERE level6 =
> > '" & sLev6 & "'"
> > sConn = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=" &
> > dbPath & ";"
> > Dim myConnd As New OleDbConnection(sConn)
> > Dim myAdapterd As New OleDbDataAdapter(SQLdata, myConnd)
> > myConnd.Open()
> > Try
> > myAdapterd.Fill(dDS)
> > DLdata.DataSource = dDS.Tables(0).DefaultView
> > DLdata.DataBind()
> > Finally
> > myConnd.Close()
> > End Try
> > ========================================
> > 'code on aspx page displaying list
> > <asp:DataList ID="DLdata" runat="server" cssclass="DLdatagrid">
> > <ItemStyle CssClass="DLdata" />
> > <ItemTemplate>
> > <img src="http://pics.10026.com/?src=images/arrow.jpg" alt=""/> <a
> > href='pagedata.aspx?id=<%#DataBinder.Eval(Container.DataItem,
> > "id")%>'><%#DataBinder.Eval(Container.DataItem, "pagedata")%></a>
> > </ItemTemplate>
> > </asp:DataList

Set length of container

Hi to anyone out there that is taking the time to read this. I'm new to
.net and any help given is appreciated.
I am displaying a datalist on a page and I want to limit the length of
the returned container.dataitem that is displayed to 39 characters. How
do i do this in asp.net? I can do this in classic asp by using the
len() function, but i'm a bit stuck on how to do it in asp.net.
Thanks for any help you can give, my code is below.
========================================
'code behind creating list
Dim SQLdata As String
Dim dDS As New DataSet()
SQLdata = "SELECT id, pagedata FROM tblContent WHERE level6 =
'" & sLev6 & "'"
sConn = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=" &
dbPath & ";"
Dim myConnd As New OleDbConnection(sConn)
Dim myAdapterd As New OleDbDataAdapter(SQLdata, myConnd)
myConnd.Open()
Try
myAdapterd.Fill(dDS)
DLdata.DataSource = dDS.Tables(0).DefaultView
DLdata.DataBind()
Finally
myConnd.Close()
End Try
========================================
'code on aspx page displaying list
<asp:DataList ID="DLdata" runat="server" cssclass="DLdatagrid">
<ItemStyle CssClass="DLdata" />
<ItemTemplate>
<img src="http://pics.10026.com/?src=/library/images/arrow.jpg" alt=""/> <a
href='pagedata.aspx?id=<%#DataBinder.Eval(Container.DataItem,
"id")%>'><%#DataBinder.Eval(Container.DataItem, "pagedata")%></a>
</ItemTemplate>
</asp:DataList>the easiest way to do it is:
<%# left(DataBinder.Eval(Container.DataItem, "pagedata"), 39)%>
Karl
http://www.openmymind.net/
<marcus.lecount@.googlemail.com> wrote in message
news:1138056537.361430.326800@.z14g2000cwz.googlegroups.com...
> Hi to anyone out there that is taking the time to read this. I'm new to
> .net and any help given is appreciated.
> I am displaying a datalist on a page and I want to limit the length of
> the returned container.dataitem that is displayed to 39 characters. How
> do i do this in asp.net? I can do this in classic asp by using the
> len() function, but i'm a bit stuck on how to do it in asp.net.
> Thanks for any help you can give, my code is below.
> ========================================
> 'code behind creating list
> Dim SQLdata As String
> Dim dDS As New DataSet()
> SQLdata = "SELECT id, pagedata FROM tblContent WHERE level6 =
> '" & sLev6 & "'"
> sConn = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=" &
> dbPath & ";"
> Dim myConnd As New OleDbConnection(sConn)
> Dim myAdapterd As New OleDbDataAdapter(SQLdata, myConnd)
> myConnd.Open()
> Try
> myAdapterd.Fill(dDS)
> DLdata.DataSource = dDS.Tables(0).DefaultView
> DLdata.DataBind()
> Finally
> myConnd.Close()
> End Try
> ========================================
> 'code on aspx page displaying list
> <asp:DataList ID="DLdata" runat="server" cssclass="DLdatagrid">
> <ItemStyle CssClass="DLdata" />
> <ItemTemplate>
> <img src="http://pics.10026.com/?src=/library/images/arrow.jpg" alt=""/> <a
> href='pagedata.aspx?id=<%#DataBinder.Eval(Container.DataItem,
> "id")%>'><%#DataBinder.Eval(Container.DataItem, "pagedata")%></a>
> </ItemTemplate>
> </asp:DataList>
>
Thanks Karl, I can't believe i missed that. Why do i always miss the
obvious?
Thanks for taking the time to answer, I appreciate your help.
Karl Seguin [MVP] wrote:
> the easiest way to do it is:
> <%# left(DataBinder.Eval(Container.DataItem, "pagedata"), 39)%>
> Karl
> --
> http://www.openmymind.net/
>
> <marcus.lecount@.googlemail.com> wrote in message
> news:1138056537.361430.326800@.z14g2000cwz.googlegroups.com...