Showing posts with label ofthe. Show all posts
Showing posts with label ofthe. Show all posts

Wednesday, March 28, 2012

Substitute Values in Column in Gridview

I have a Gridview bound to an SQLDataSource (see code below). The value of
the "DayOfWeek" column is actually an integer where 0 = Daily, 1=Sunday,
2=Monday, etc. How can I change what is displayed in the column from values
like 1or 2 to "Sunday", "Monday"?

============== Code =================
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"

AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
<Columns
<asp:BoundField DataField="EventName" HeaderText="EventName"
SortExpression="EventName" /
<asp:BoundField DataField="DayOfWeek" HeaderText="DayOfWeek"
SortExpression="DayOfWeek" /
<asp:BoundField DataField="Occurs" HeaderText="Occurs"
SortExpression="Occurs" /
<asp:BoundField DataField="Location" HeaderText="Location"
SortExpression="Location" /
</Columns
</asp:GridViewI finally found an example that I could apply. I created a Select Case
function named GetDayOfWeek to return the string I wanted for each case and
then replaced the Bound Column in the ASP code to:

<asp:TemplateField HeaderText="Day of Week"
<ItemTemplate
<%#GetDayOfWeek(CInt(Eval("DayOfWeek")))%
</ItemTemplate
</asp:TemplateField
Wayne

"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:ut%232Q9SRGHA.4696@.tk2msftngp13.phx.gbl...
>I have a Gridview bound to an SQLDataSource (see code below). The value of
>the "DayOfWeek" column is actually an integer where 0 = Daily, 1=Sunday,
>2=Monday, etc. How can I change what is displayed in the column from values
>like 1or 2 to "Sunday", "Monday"?
>
> ============== Code =================
> <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
> AllowSorting="True"
> AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
> <Columns>
> <asp:BoundField DataField="EventName" HeaderText="EventName"
> SortExpression="EventName" />
> <asp:BoundField DataField="DayOfWeek" HeaderText="DayOfWeek"
> SortExpression="DayOfWeek" />
> <asp:BoundField DataField="Occurs" HeaderText="Occurs"
> SortExpression="Occurs" />
> <asp:BoundField DataField="Location" HeaderText="Location"
> SortExpression="Location" />
> </Columns>
> </asp:GridView>

Subweb / Subprojects VS2005

I have a web site which we use to service many customers. The base part of
the web site is the same for every customer. Then there are sub-webs for
each customer that contain customer specific pages only. How do we structur
e
the projects such that I don't need to build one solution which contains the
base web and every customer web while maintaining session accross all the
webs? One of the frustrating things about VS is that if it finds a sub web
it tries to compile it. So i remove the sub-web and everything compiles, bu
t
now how do I test the sub-web when I can't navigate through the base web?
More info...each web (base and customer) has a bunch of supporting
assemblies (service, data, rules, etc). The base web should not change ver
y
frequently but each sub-web (customer specific) will be on a different
release cycle. So I need to keep them separate.
I have read the Guthrie articles on VS2005 projects and while they get me
pretty close, they don't seem to address my issues.
I refuse to belive that this problem is uniqute and hopefully someone on the
ASP.NET / VS team has thought about this scenario. Any help would be much
appreciated.
Thanks,
curtSilence sucks, if I am off my rocker just tell me so ;-).
Thanks,
curt
"Curt Koppang" wrote:

> I have a web site which we use to service many customers. The base part o
f
> the web site is the same for every customer. Then there are sub-webs for
> each customer that contain customer specific pages only. How do we struct
ure
> the projects such that I don't need to build one solution which contains t
he
> base web and every customer web while maintaining session accross all the
> webs? One of the frustrating things about VS is that if it finds a sub we
b
> it tries to compile it. So i remove the sub-web and everything compiles,
but
> now how do I test the sub-web when I can't navigate through the base web?
> More info...each web (base and customer) has a bunch of supporting
> assemblies (service, data, rules, etc). The base web should not change v
ery
> frequently but each sub-web (customer specific) will be on a different
> release cycle. So I need to keep them separate.
> I have read the Guthrie articles on VS2005 projects and while they get me
> pretty close, they don't seem to address my issues.
> I refuse to belive that this problem is uniqute and hopefully someone on t
he
> ASP.NET / VS team has thought about this scenario. Any help would be much
> appreciated.
> Thanks,
> curt