Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<asp:datagrid id="dgrdTelnos" runat="server" Width="150px" BackColor="White" BorderStyle="None"
                                                            BorderWidth="1px" BorderColor="#CC9966" CellPadding="1" AutoGenerateColumns="False" PageSize="20">
                                                            <FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
                                                            <SelectedItemStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedItemStyle>
                                                            <ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
                                                            <HeaderStyle Font-Bold="True" ForeColor="#FFFFCC" BackColor="#990000"></HeaderStyle>
                                                            <Columns>
                                                                <asp:TemplateColumn Visible="False" HeaderText="Tel_Rec_Code" FooterText="Tel_Rec_Code">
                                                                    <HeaderStyle Width="5%"></HeaderStyle>
                                                                    <ItemTemplate>
                                                                        <asp:label id=lblTel_Rec_Code runat="server" CssClass="textbox" Text='<%# cstr(container.dataitem("Tel_Rec_Code") &amp; "") %>'>
                                                                        </asp:label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateColumn>
                                                                <asp:TemplateColumn HeaderText="Telephone No." FooterText="Telephone No.">
                                                                    <HeaderStyle Width="70%"></HeaderStyle>
                                                                    <ItemTemplate>
                                                                        <asp:label id=lblTelephone runat="server" CssClass="textbox" Text='<%# cstr(container.dataitem("Telephone") &amp; "") %>'>
                                                                        </asp:label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateColumn>
                                                                <asp:TemplateColumn HeaderText="Status" FooterText="Status">
                                                                    <HeaderStyle HorizontalAlign="Center" Width="30%"></HeaderStyle>
                                                                    <ItemTemplate>
                                                                        <asp:Button id="cmdTelStatus" CssClass="textbox" Width="15px" Height="15px" BorderStyle="Groove"
                                                                            Runat="server"></asp:Button>
                                                                        <asp:Label id=lblTelStatus Width="42px" Visible="False" Runat="server" text='<%# cstr(container.dataitem("telephone_Tag") &amp; "") %>'>
                                                                        </asp:Label>
                                                                        <asp:TextBox id=hidTel runat="server" ForeColor="White" CssClass="textbox" Width="0px" BorderStyle="None" Text='<%# cstr(container.dataitem("telephone_Tag") &amp; "") %>'>
                                                                        </asp:TextBox>
                                                                    </ItemTemplate>
                                                                </asp:TemplateColumn>
                                                            </Columns>
                                                            <PagerStyle HorizontalAlign="Center" ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle>
                                                        </asp:datagrid></TD>
                                                    <TD style="WIDTH: 94px" vAlign="middle" width="94" height="1"><STRONG>Fax&nbsp;No.</STRONG></TD>
                                                    <TD vAlign="middle" align="left" colSpan="5" height="1"><asp:datagrid id="dgrdFaxnos" runat="server" Width="150px" BackColor="White" BorderStyle="None"
                                                            BorderWidth="1px" BorderColor="#CC9966" CellPadding="1" AutoGenerateColumns="False" PageSize="20">
                                                            <FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
                                                            <SelectedItemStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedItemStyle>
                                                            <ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
                                                            <HeaderStyle Font-Bold="True" ForeColor="#FFFFCC" BackColor="#990000"></HeaderStyle>
                                                            <Columns>
                                                                <asp:TemplateColumn Visible="False" HeaderText="Fax_Rec_Code" FooterText="Fax_Rec_Code">
                                                                    <HeaderStyle Width="80%"></HeaderStyle>
                                                                    <ItemTemplate>
                                                                        <asp:label id="lblFax_Rec_Code" runat="server" CssClass="textbox" Text='<%# cstr(container.dataitem("Fax_Rec_Code") & "") %>'>
                                                                        </asp:label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateColumn>
                                                                <asp:TemplateColumn HeaderText="Fax No." FooterText="Fax No.">
                                                                    <HeaderStyle Width="70%"></HeaderStyle>
                                                                    <ItemTemplate>
                                                                        <asp:label ID="lblFax" CssClass="textbox" runat="server" Text='<%# cstr(container.dataitem("Fax") & "") %>'>
                                                                        </asp:label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateColumn>
                                                                <asp:TemplateColumn HeaderText="Status" FooterText="Status">
                                                                    <HeaderStyle HorizontalAlign="Center" Width="30%"></HeaderStyle>
                                                                    <ItemTemplate>
                                                                        <asp:Button id="cmdFaxStatus" CssClass="textbox" Width="15px" Height="15px" BorderStyle="Groove"
                                                                            Runat="server"></asp:Button>
                                                                        <asp:Label id=lblFaxStatus Visible="False" Runat="server" text='<%# cstr(container.dataitem("Fax_Tag") &amp; "") %>'>
                                                                        </asp:Label>&nbsp;
                                                                        <asp:TextBox id=hidFax runat="server" ForeColor="White" CssClass="textbox" Width="0px" BorderStyle="None" text='<%# cstr(container.dataitem("Fax_Tag") &amp; "") %>'>
                                                                        </asp:TextBox>
                                                                    </ItemTemplate>
                                                                </asp:TemplateColumn>
                                                            </Columns>
                                                            <PagerStyle HorizontalAlign="Center" ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle>
                                                        </asp:datagrid></TD>














































function ValidateColour_Tel(a,b)
        {

            if ((document.getElementById(a).style.background == "") || (document.getElementById(a).style.background == "#cccccc"))
                {
                document.getElementById(a).style.background = "LightGreen";
                document.getElementById(a).style.color = "LightGreen";
                document.getElementById(b).value = "1";
                //hidTelStatus
                //document.form1.hidC1.value = "1";
                //document.form1.txttel1.focus();
                return false;
                }

            if (document.getElementById(a).style.background == "lightgreen")
                {
                document.getElementById(a).style.background = "Red";
                document.getElementById(a).style.color = "Red";
                document.getElementById(b).value = "2";
                //document.form1.hidC1.value = "2";
                //document.form1.txttel1.focus();
                return false;
                }

            if (document.getElementById(a).style.background == "red")
                {
                document.getElementById(a).style.background = "#cccccc";
                document.getElementById(a).style.color = "#cccccc";
                document.getElementById(b).value = "0";
                //document.form1.hidC1.value = "";
                //document.form1.txttel1.focus();
                return false;
                }
        }













































Private Sub dgrdTelnos_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgrdTelnos.ItemDataBound

        Try

            Select Case e.Item.ItemType
                Case ListItemType.AlternatingItem, ListItemType.EditItem, ListItemType.Item, ListItemType.SelectedItem
                    Dim objlblStatus As New Label
                    Dim objcmdStatus As New Button
                    Dim objlblTel As New Label
                    Dim objhidTelStatus As TextBox


                    objlblTel = e.Item.FindControl("lblTelephone")
                    objlblStatus = e.Item.FindControl("lblTelStatus")
                    objcmdStatus = e.Item.FindControl("cmdTelStatus")
                    objhidTelStatus = e.Item.FindControl("hidTel")

                    If objlblTel.Text.Trim <> "" Then
                        If CInt(CStr(objlblStatus.Text & "0")) = 0 Then
                            objcmdStatus.BackColor = SystemColors.Control.FromName("#cccccc")
                            objhidTelStatus.Text = "0"
                        ElseIf objlblStatus.Text = "1" Then
                            objcmdStatus.BackColor = Color.LightGreen
                            objhidTelStatus.Text = "1"
                        ElseIf objlblStatus.Text = "2" Then
                            objcmdStatus.BackColor = Color.Red
                            objhidTelStatus.Text = "2"
                        End If
                        objcmdStatus.Visible = True
                        objcmdStatus.Attributes.Add("OnClick", "return ValidateColour_Tel('" & objcmdStatus.ClientID & "','" & objhidTelStatus.ClientID & "');")

                    Else
                        objcmdStatus.Visible = False
                    End If

                Case Else

            End Select
        Catch ex As Exception
            Dim objCurrent As Object
            Dim strPageName As String
            strPageName = Page.GetType().Name.ToString().Replace("_aspx", ".aspx")
            objCurrent = System.Reflection.MethodBase.GetCurrentMethod()
            objError.ErrorLogging(Session("UserName"), ex.Message, strPageName, objCurrent.Name)

        Finally

        End Try
    End Sub
Posted
Comments
ZurdoDev 26-Apr-13 7:40am    
What works? What doesn't work? Should we just guess?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900