.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

evaluate data in row and change text on asp:ButtonField accordingly.

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

I am building a website for my hockey league.


I have a gridview that displays the current weeks scheduled games. Ideally I have added a column to the end of the gridview that I would like display 1 of 3 values. If the game has already been played I would like to display the score of the game; if the game has yet to be played I would like the column blank and if someone on either team has indicated that they can't make the game I would like to display a button that says "subs needed" and take you to another page to sign up to be a sub. Can this be done? I have been able to change the background color of the line based on the two boolean flags from the database using the RowDataBound event handler but I can't seem to find a way to set the value of a specific field in my row. (The background is set for the whole row.)

Thanks in advance -eric

View Complete Post

More Related Resource Links

Change data type of library field from Single Line Text to currency


I have an InfoPath 2010 form that has a field listing the amount of currency on a meter. It is a Decimal form in Infopath but publishes to SharePoint as a Single Line of Text.  It will not let me modify the column in SharePoint and it will not let me select the allow edit from the Publishing Wizard.  I need the column as a currency so my Excel Queries work.



Change Button Text in Multi Language Website


Hi i developing multi language website

using Master pages

everything fine

Page_Load i set the Text property of Button Control from Resource file

like this

Button1.Text = GetLocalResourceObject("Button1")

then in the button click event i cnage the text of the Button control

Button1.Text = GetLocalResourceObject("Button1_new")

but the text doesn't change and no error messgae

what is the problem how to solve this


How to change text in columns in SSRS?


I need to create a complex report and export it to Excel. 

In the first column header, text is displayed as "Hide Daily Columns", but I need the text to change as "Unhide Daily columns" when I click on it and when the text changes the columns under "daily" header (I have 3 columns under this header) present in the report shud be hidden and only weekly columns shud be visible. Any ideas please. I am new to SSRS and tried out many ways but didn't get it.

Change data on gridview bind


Hi there,

Simple little problem. i have a gridview that shows products assigned to a customers job. They are displayed in exVAT prices. To make it easier i want to show the inc VAT prices. How can i add VAT to 1 column in this table?

How can I change the color of my clandar by data from Db

Sub DayRender(ByVal source As Object, ByVal e As DayRenderEventArgs)

            Dim i As Integer
            For i = 0 To DataGrid1.Items.Count - 1
            'If (DataGrid1.Items(i).Cells(1).Text = e.Day.Date) Then
            'If (DataGrid1.Items(i).Cells(0).Text <> "") Then
            If (DataGrid1.Items(i).Cells(1).Text.Equals(e.Day.Date.ToString)) Then

                '  e.Cell.BackColor = Color.DarkOrange
                e.Cell.BackColor = System.Drawing.Color.Red
                e.Cell.ForeColor = System.Drawing.Color.Yellow

            End If
now I click the day on clendar, which have data from db it chage color ,  How can I let when the calendar is load wich day have dat in db change color ?

    End Sub


change calendar date backColor base on data from db


I want to  change calendar date backColor base on data from db,  I only have vistual 2003 !

on mean time I have

<asp:DataGrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 23px; POSITION: absolute; TOP: 271px"
		    runat="server" Font-Size="XX-Small" Font-Names="Verdana" AutoGenerateColumns="False" Visible="False">
           <asp:BoundColumn DataField="subject" HeaderText="Title"></asp:BoundColumn>
           <asp:BoundColumn DataField="posttimestart" HeaderText="Post date"></asp:BoundColumn>


Sub DayRender(ByVal source As Object, ByVal e As DayRenderEventArgs)
        Dim i As Integer
        For i = 0 To DataGrid1.Items.Count - 1
            If (DataGrid1.Items(i).Cells(1).Text = e.Day.Date) Then
                e.Cell.BackColor = Color.DarkOrange

            End If

    End Sub

when I click the day wich have data in db it change  color , but I want the page load it change color !

Thank you!

Change label text on master page from the content page.

Hello. Can I access the objects (for example change the label text) on the master page, from its contents page code? If yes, how can I approach that? Thank you Artashes

DataGrid ValidationRule or IDataErrorInfo validation code called multiple times for each data change

Following my enquiry regarding a problem in Datagrid validation, for which managing exceptions is apparently a problem, I tested the two other methods: using validation rules, or implementing the IDataErrorInfo interface. I ran into other problems there, more insidious this time. This has been done on Windows7 (32-bit), .NET 4.0.30319. 1) IDataErrorInfo When this interface is implemented, the this[string columnName] property is called four times for each modification: two times before the cell enters edit mode (with the old value in the corresponding property) two times when the new value has to be validated (with the new value) It strikes me as not really efficient, is there something wrong with my code? Here's the C# part: using System; using System.Windows; using System.Collections.ObjectModel; using System.ComponentModel; namespace DataGridTest2 { public partial class MainWindow : Window { ObservableCollection<User> users; public MainWindow() { InitializeComponent(); users = new ObservableCollection<User>() { new User { Name = "Teddy", Age = "2" }, new User { Name = "Avi", Age = "19" } }; datagrid.ItemsSource = users; datagrid.Focus(); } } public class User : INotifyPropertyChanged, IDataErrorInfo { string name; public string Name

Data loading from text file

Hi, I am loading the data from a flat file into a sql table. The values in one of the column have spaces at the end of the value. I want to remove those spaces and load into the table. I am thinking of using derived column and use rtrim on that column, how can I use that as an expression. Thanks.sqldev

Change Text of Sharepoint Form Dialog title Bar

Hi, I am having Sharepoint 2010 RTM Trial on Windows Server 2008 SP2. I have published custom infopath form to sharepoint List. I have two views in that form, One is called AddItem and The other one is called EditItem. I have use the infopath rule to switch views depending on some condition and it is working fine. But when the view is switched to EditItem, I want to Customize the Title bar of Form Dialog to my custom text.... Can anybody have an answer ? Regards

Data from text files, What's wrong with my code?

Hi all, I have uploaded some tab-delimited .txt files on my web site (actually run on my computer, ie localhost, for now), and now I try to retrieve the data from those files. I do this by calling a vb file containg the sub below. Everything works great, except that the sub won't recognise unicode characters. I can split the resulting string using vbnewline and vbtab, but already in the sub in question, the string doesn't understand the Swedish letters åäö, apostrophes and more. Any help would be greatly appreciated! /Pettrer       Shared Function getTextfile(ByVal FullPath As String, Optional ByRef ErrInfo As String = "") As String Dim strContents As String = "" Dim objReader As StreamReader Try objReader =New StreamReader(FullPath) 'UTF8Encoding? strContents = objReader.ReadToEnd() objReader.Close() ErrInfo = Ex.MessageCatch Ex As Exception End Try Return strContents End Function  

Inserting data from a text box

Hi All, I am trying to insert data in one of the tables using SQL Server. Below is the sql command: string insertSQL = "Insert into CUSTOMERS (" + " CUSTOMER_NAME" + ") VALUES (" + custname.Text + ")"; SqlCommand insertcmd = new SqlCommand(insertSQL, myConnection); //Add parameters insertcmd.Parameters.AddWithValue("@ID", custname.Text); When I insert the customer name in the custname text box it is throwing me an error called "Invalid column name 'ABC'". While ABC is the customer name entered in the custname text box. Please suggest!! Regards, Abhinav Mehta

how to check the data which i passesd in text box for logine is available in the database or not.

Hi, I created login form in which ---Username, Password & LogOnType is there, When i m passing the correct value i m login successfully. But instead of entering correct value when i m entering wrong values and clicking SignIN its gives the exception. If i m not entering any value in text box and clicking SignIn its ask for values..................................... How i will make the validation which will check the textbox data which i entered there is correct or not. I want error  msg when data not in the database.........................if data in database then successfully logedIn msg.............   please help me ..............................try to give one example with code if possible   Thanku  

Change text in datagrid in databound, in wpf

Hi, i have a wpf datagrid, heres my datagrid   <dg:DataGrid x:Name="dataGrid" AutoGenerateColumns="false" ColumnHeaderStyle="{StaticResource columnHeaderStyle}" AlternationCount="2" RowBackground="Beige" RowStyle="{StaticResource rowStyle}" AlternatingRowBackground="LightBlue" HeadersVisibility="All" HorizontalGridLinesBrush="#DDDDDD" VerticalGridLinesBrush="#DDDDDD" Grid.ColumnSpan="2" Margin="0,0,0,26" IsReadOnly="True" ColumnHeaderHeight="30"> <dg:DataGrid.Columns> <dg:DataGridTextColumn Header=" Task Id" Binding="{Binding Path=TaskId}" Width="60" /> <dg:DataGridTextColumn Header="Order Description" Binding="{Binding Path=OrderDescription}" Width="120"/> <dg:DataGridTextColumn Header="Final Client Name" Binding="{Binding Path=ClientName}" Width="110"/> <dg:DataGridTextColumn Header="Order Date" Binding="{Binding Path=OrderDate}" Width="80"/> <dg:DataGridTextColumn Header="Task Description" Binding="{Binding Path=TaskDescription}" Width="130"/>

change data source of cube

how to change data source of cube?

change the date rang in calendar depend on the data from db

if the calendar day is match with the date in db I can change the claendar 's background color  with the following code , How if I want  my calendar change color by the range of the data in my db ,  said I want the calendar change color from the starDay to endday of the event , the date rang is random what can I do ??  For Each dr In tmpds.Tables(0).Rows                    If Not dr("startDay") Is DBNull.Value Then                        Dim dtEvent As DateTime = dr("startDay").ToString

Change background colour based on data key change?

Hi there,I have a GridView with an alternating Css style. The GridView has a column called tradeId. What I want to show is an alternating colour based on a change in the tradeId. Is this possible? It will make it easier on the eye to group trades together by colour. Here's the GridView code as it is right now:<asp:GridView             ID="dtlEntryStats"             runat="server"             DataSourceID="sdsEntryStats"             DataKeyNames="tradeId"             AlternatingRowStyle-CssClass="alternating"            GridLines="None"             CssClass="gridView"            AutoGenerateRows="false"             AutoGenerateColumns="false"             AllowPaging="true"           &n
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend