Click here to Skip to main content
16,005,120 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_15-Jun-06 0:37
_AK_15-Jun-06 0:37 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane15-Jun-06 0:48
varshavmane15-Jun-06 0:48 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_15-Jun-06 1:13
_AK_15-Jun-06 1:13 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane15-Jun-06 1:25
varshavmane15-Jun-06 1:25 
GeneralRe: Bind Datagrid With Viewstate Pin
_AK_15-Jun-06 1:33
_AK_15-Jun-06 1:33 
GeneralRe: Bind Datagrid With Viewstate Pin
varshavmane15-Jun-06 1:46
varshavmane15-Jun-06 1:46 
Questionasp.net application with recordset Pin
Sameer Salkar14-Jun-06 17:54
Sameer Salkar14-Jun-06 17:54 
QuestionHyperlinkcolumn - change color of link Pin
NewbieDave14-Jun-06 12:04
NewbieDave14-Jun-06 12:04 
I am using ASP.net 1.1 in Visual Studio 2003. I have a datagrid that changes a rows color based on a column's value. I want the links to change to the same ForeColor as the text in the bound columns. Here is some of my code:

VB CODE

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
SqlDataAdapter1.Fill(DataSet11, "Table")
DataGrid1.DataSource = DataSet11.Tables("Table").DefaultView
DataGrid1.DataBind()
SqlDataAdapter2.Fill(DsBackLogHrs1, "dbo_USER_BackLog_Hours")
txtBackLogHrs.DataBind()

End Sub
Private Sub dgContacts_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
' Make sure that this is a data row and not a header or footer.
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then

' Get the value of the SortOrder Field. This field is an integer that describes the Data row.
' 0 = active Ro
' 5 = Parts Are In (Active RO)
' 10 = Parts Are In (Non Active RO)
' 30 = Comeback
' 50 = Customer Waiting (Non active RO)
' 300 = Stale RO (No one has punched onto this RO for 48 hours)
' 150 = Open RO
' 175 = Parts on BackOrder

Dim isTimeAvail As Single
Dim isTimetoPickup As Single
Dim isTimetoNewPickup As Single
Dim isNewPickup As DateTime
Dim isDescript As String = CType(DataBinder.Eval(e.Item.DataItem, "Descript"), String)
Dim isDateProm As DateTime = CType(DataBinder.Eval(e.Item.DataItem, "DateProm"), DateTime)
Dim isSortOrder As Single = CType(DataBinder.Eval(e.Item.DataItem, "SortOrder"), Single)
Dim isFlatHrs As Single = CType(DataBinder.Eval(e.Item.DataItem, "FlatHrs"), Single)
Dim isTechHrs As Single = CType(DataBinder.Eval(e.Item.DataItem, "TechHrs"), Single)

Select Case isSortOrder
Case 5
e.Item.ForeColor = System.Drawing.Color.Green
e.Item.Font.Bold = System.Drawing.FontStyle.Bold
Case 10
e.Item.BackColor = System.Drawing.Color.Green
e.Item.ForeColor = System.Drawing.Color.White
Case 30
e.Item.ForeColor = System.Drawing.Color.DarkRed
e.Item.Font.Bold = System.Drawing.FontStyle.Bold
Case 50
e.Item.ForeColor = System.Drawing.Color.Navy
e.Item.Font.Bold = System.Drawing.FontStyle.Bold
Case 175
e.Item.BackColor = System.Drawing.Color.Gray
Case 300
e.Item.BackColor = System.Drawing.Color.Tan
e.Item.ForeColor = System.Drawing.Color.Black
End Select
ASP Code:


<title>WebForm1





.inGreen {COLOR: green; TEXT-DECORATION: none}
.inDarkRed {COLOR: DarkRed; TEXT-DECORATION: none}
.inNavy {COLOR: Navy; TEXT-DECORATION: none}
.inBlack {Color: Black; Text-decoration: None}
.inOrange {Color: OrangeRed; Text-decoration: None}
.inWhite {Color: White; Text-decoration: None}




<asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 80px" runat="server" height="383px" width="990px" datasource="<%# DataSet11 %>" autogeneratecolumns="False" datamember="Table" bordercolor="Fuchsia">
<itemstyle font-names="Verdana">
<columns>
<asp:hyperlinkcolumn datatextfield="SalesId" datanavigateurlfield="SalesId" datanavigateurlformatstring="javascript:varwin=window.open('WebForm2.aspx?SalesId={0}',null,'width=950,height=625, resizable=yes, Scrollbars=yes');void('');"
="" headertext="Repair Order #">
<headerstyle font-names="Verdana" font-bold="True">

<asp:hyperlinkcolumn datatextfield="CustName" datanavigateurlfield="SalesId" datanavigateurlformatstring="javascript:varwin=window.open('CustomerInfo.aspx?SalesId={0}',null,'width=892,height=350, resizable=yes, Scrollbars=yes');void('');"
="" headertext="Customer Name">
<headerstyle font-names="Verdana" font-bold="True">
<itemstyle font-names="Verdana">

<asp:boundcolumn datafield="DateCreated" headertext="Date Create" dataformatstring="{0Big Grin | :-D }">
<headerstyle font-names="Verdana" font-bold="True">

<asp:boundcolumn datafield="DateProm" headertext="Date/Time Promised">
<headerstyle font-names="Verdana" font-bold="True">
<itemstyle font-size="Smaller" font-names="Verdana">

<asp:boundcolumn visible="False" datafield="SortOrder" headertext="SortOrder">
<asp:boundcolumn datafield="Descript" headertext="Description">
<headerstyle font-names="Verdana" font-bold="True">

<asp:boundcolumn datafield="FlatHrs" sortexpression="FlatHrs" headertext="FlatHrs">
<asp:hyperlinkcolumn datatextfield="TechHrs" datanavigateurlfield="SalesId" datanavigateurlformatstring="javascript:varwin=window.open('TechPunches.aspx?SalesId={0}',null,'width=950,height=625, resizable=yes, Scrollbars=yes');void('');"
="" headertext="TechHrs" datatextformatstring="{0:N2}">

<cc1:webtimer id="WebTimer1" runat="server" <="" small="">

Thanks for all the help
NewbieDave

AnswerRe: Hyperlinkcolumn - change color of link Pin
minhpc_bk14-Jun-06 16:18
minhpc_bk14-Jun-06 16:18 
Questionwhich is better ? Pin
anj198314-Jun-06 9:10
anj198314-Jun-06 9:10 
AnswerRe: which is better ? Pin
Elina Blank14-Jun-06 9:27
sitebuilderElina Blank14-Jun-06 9:27 
QuestionDatagrid; using multiple tables and getting blank row Pin
leckey14-Jun-06 8:45
leckey14-Jun-06 8:45 
AnswerRe: Datagrid; using multiple tables and getting blank row Pin
ToddHileHoffer14-Jun-06 9:07
ToddHileHoffer14-Jun-06 9:07 
GeneralRe: Datagrid; using multiple tables and getting blank row Pin
leckey14-Jun-06 9:12
leckey14-Jun-06 9:12 
QuestionHow to get selected values from dynamically created checklist? Pin
omerrauf14-Jun-06 6:02
omerrauf14-Jun-06 6:02 
AnswerRe: How to get selected values from dynamically created checklist? Pin
ToddHileHoffer14-Jun-06 7:50
ToddHileHoffer14-Jun-06 7:50 
AnswerRe: How to get selected values from dynamically created checklist? Pin
Mircea Grelus14-Jun-06 8:33
Mircea Grelus14-Jun-06 8:33 
GeneralRe: How to get selected values from dynamically created checklist? Pin
ToddHileHoffer14-Jun-06 8:38
ToddHileHoffer14-Jun-06 8:38 
GeneralRe: How to get selected values from dynamically created checklist? Pin
Mircea Grelus14-Jun-06 8:45
Mircea Grelus14-Jun-06 8:45 
QuestionAsp 2.0 Gridview/SqlDataSource update/delete problem Pin
Fr23516614-Jun-06 4:00
Fr23516614-Jun-06 4:00 
AnswerRe: Asp 2.0 Gridview/SqlDataSource update/delete problem Pin
ToddHileHoffer14-Jun-06 8:02
ToddHileHoffer14-Jun-06 8:02 
GeneralRe: Asp 2.0 Gridview/SqlDataSource update/delete problem Pin
Fr23516614-Jun-06 22:28
Fr23516614-Jun-06 22:28 
AnswerRe: Asp 2.0 Gridview/SqlDataSource update/delete problem Pin
minhpc_bk14-Jun-06 19:56
minhpc_bk14-Jun-06 19:56 
GeneralRe: Asp 2.0 Gridview/SqlDataSource update/delete problem Pin
Fr23516614-Jun-06 22:00
Fr23516614-Jun-06 22:00 
GeneralRe: Asp 2.0 Gridview/SqlDataSource update/delete problem Pin
minhpc_bk14-Jun-06 22:19
minhpc_bk14-Jun-06 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.