Question : Client side javascript enabling fields in a listview

Hi guys,

I just can't find a solution to my problem even after searching for a few hours .
I found a few articles that are familiar to my prblem but the sugested solutions aren't cutting it for me.
1) http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22729197.html
2) http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_24296379.html?sfQueryTermInfo=1+javascript+listview

What I want to do:
I've a listview in insertmode where users can create new debtor request. When a certain debtor is selected I want that the javascript function enables two templatefields (if this isn't possible, i would like to make two textbox visible).

Programming in: VS 2008, ASP.NET and C#
I use LINQ to insert the values in the database.

The template field with the dropdownlist:

 
   
 

 
   
                           
                           
                           
                           
   

    r ID="rfvKindOfDebtor" runat="server" ErrorMessage="*" ControlToValidate="ddlKindOfDebtor" />    
 



When the index of the ddl would change the code below should be triggerd.
The javascript:


My problem:
'm getting 4 errors based on the first line of the code (<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NewDebtor.aspx.cs" Inherits="NewDebtor" %>):
1 - )expected
2 - Invalid expression term ':'
3 - ; expected
4 - Invalid expression term ')'

If I remove the onSelectedIndexChanged property, the errors disapear, what's going wrong?

Best of regards,
Hugo

Answer : Client side javascript enabling fields in a listview

The OnSelectedIndexChanged property is server side, to call client side javascript you can add an attribute for the onchange:

something like

ddlKindOfDebtor.attributes.add("onchange","javascript:IndexChanged(this.id);");

This will add the javascript to the html element and should run the script you require.
Random Solutions  
 
programming4us programming4us