473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

C# Web-App: javascript function doesn't contain a definition for rowcolor(fucntion)

I am write a function in javascript ie
Expand|Select|Wrap|Line Numbers
  1. function rowcolor(obj)
  2. {
  3.     obj.parentelement.parentelement.style.backgroundcolor='yellow' ;
  4. }
when i run the appln the error is occure ie the definition of rowcolor doesn't exist

please tellme where to write my javascript function
i give my detail code below
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Debug="true" Inherits="Default5" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Untitled Page</title>
  8.  
  9. </head>
  10. <body>
  11.     <form id="form1" runat="server">
  12.     <div>
  13.         &nbsp;&nbsp;&nbsp;
  14.  
  15.  
  16.         <asp:GridView ID="GridView1" runat="server" Style="z-index: 100; left: 135px; position: absolute;
  17.             top: 193px" Width="403px" AutoGenerateColumns="False" Height="153px">
  18.             <Columns>
  19.             <asp:TemplateField>
  20.             <ItemTemplate>
  21.             <asp:CheckBox ID="chkSelect" OnCheckedChanged="rowcolor(this)" runat="server" />
  22.             </ItemTemplate>
  23.             </asp:TemplateField>
  24.             <asp:TemplateField HeaderText="emp_id">
  25.             <ItemTemplate>
  26.             <asp:Label ID="lblEmpid" runat="server" Text='<%# Eval("emp_id") %>' />
  27.             </ItemTemplate>
  28.             </asp:TemplateField>
  29.             <asp:TemplateField HeaderText="fname">
  30.             <ItemTemplate>
  31.             <asp:Label ID="lblFname" runat="server" Text='<%# Eval("fname") %>' />
  32.             </ItemTemplate>
  33.             </asp:TemplateField>
  34.  
  35.             </Columns>
  36.         </asp:GridView>
  37.        </div>
  38.     </form>
  39.  
  40. </body>
  41. </html>
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2.  function rowcolor(obj)
  3.     {
  4.    obj.Parentelement.Parentelement.Style.BackgroundColor='yellow';
  5.     }
  6.     </script>
Dec 14 '07 #1
3 1426
radcaesar
759 Expert 512MB
Call the method like this,

OnCheckedChanged="javascript: rowcolor(this)";
Dec 14 '07 #2
hello radcaesar
I have done it ,but it gives error ie cs1026 and ")" is expected.I am using server control not html control.I can't detect where i insert this " ) " .Have any solution please give me.Thanks a lot



OnCheckedChanged="javascript: rowcolor(this)";
Dec 14 '07 #3
radcaesar
759 Expert 512MB
May be u miss the ; at the end

OnCheckedChanged="javascript: rowcolor(this);"
Dec 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: WZ | last post by:
I used the following code to create a workbook and save it in a webapplication. dim oExcel As Excel.ApplicationClass dim oBook As Excel.WorkbookClass dim obooks As Excel.Workbooks dim designb...
86
by: Walter Roberson | last post by:
If realloc() finds it necessary to move the memory block, then does it free() the previously allocated block? The C89 standard has some reference to undefined behaviour if one realloc()'s memory...
5
by: ranjeet.gupta | last post by:
Dear All As I was going through the Recent replies on the realloc(), I got some question and my annalysis on that, so regarding on these please guide me where I fail on the theoritical and...
0
by: vijaya | last post by:
I want to set a row i.e. upon calling my fucntion SetRow(int val), the cursor should be present in that particualr row. I dont want to use Edit button for my web daatgrid How to acheive it?
0
by: Mark Kelly | last post by:
(originally posted on framework.aspnet.datagridcontrol) Hi, I don't seem to be able to get a imagebutton (within a template column) to fire an itemcommand event when clicked. Looking through this...
4
by: Denise | last post by:
I am trying to implement database error logging in my asp.net application. When I inspect the exception variable, I see that there is a property called 'procedure' which I believe is the procedure...
1
by: Bala | last post by:
Hi Currently I am displaying the list of files name on my datagrid. The files physcially stored on network machine call TestMachine, not in the webserver. r In grid the file path says...
4
by: Jeff Lynch | last post by:
I need to call a class on every web page in a site. In ASP.NET 1.1 I would call this class before the Page_Load event in each web page's code-behind file since it needs to run before the web page...
3
by: poolieweb | last post by:
I have created a custom user control which creates a ASPxMenu ( Same fucntion as standard menu control) from data retreved from a webservice (Reporting Services) which deals with user access. This...
5
by: Iulian Ilea | last post by:
Hello! I've created a PDF report and trying to load a picture using LoadPicture fucntion. It works fine on my computer but it gives an error on some other computers - permision denied, or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.