-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: BalajiKrishnan
Message 3 in Discussion

I have done the code,but in javascript function,
I'm first clearing the 2nd DDL values(calling function in onblur event of the 1st DDL).

        When I debug ,it says "2nd DDL(control name)"
is null or not an object.
 what could be the problem...........   Code :   JavaScript:   <script 
language="javascript">
                        function fetlevel()
                        {
                                var _a = 
document.all?document.all.r1.style:document.r1;
                                _a.visibility="hidden";
                        }
                </script> 
<script language="javascript">
                        function showDescr()
                        {
                                alert("inside");
                                var frm=document.subcat;

                                alert(frm.DdlSubcategory.options.length);
                                for(i=0;i< frm.DdlSubcategory.options.length;i++)
                                {
                                        frm.DdlSubcategory.options[i--]=null;
                                }
                                for(k=0;k < frm.hidlevel.options.length; k++)
                                {
                                        var data = frm.hidlevel.options[k].value;
                                        var locate = data.indexOf('--');
                                        var lev = data.substring(data,locate);
                                        
if(lev==frm.DdlCategory.options[frm.DdlCategory.selectedIndex].value)
                                        {
                                                var anOption = 
document.createElement("OPTION");
                                                
frm.DdlSubcategory.options.add(anOption);
                                                anOption.innerText = 
frm.hidlevel.options[k].text;
                                                anOption.Value = 
frm.hidlevel.options[k].text;
                                        }
                                }
                        }
                </script>
   td><asp:dropdownlist id="DDLCategory" onblur="showDescr()" 
runat="server" Width="152px"></asp:dropdownlist></td>
 <td><asp:dropdownlist id="DdlSubcategory" runat="server" 
AutoPostBack="True" Width="160px">   ----------------------------------------- Code 
behind.... Imports System.Data.OleDb
Imports System.Data.OleDb.OleDbConnection
Imports System.Data.OleDb.OleDbCommand
Public Class Category1
    Inherits System.Web.UI.Page
    Dim conn As New 
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data 
Source=d:/blackstar/dvd.mdb ")
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
        'Response.CacheControl = "no-cache"
        conn.Open()
        If Request("show") = "add" Then
            Dim Selectcat As OleDb.OleDbCommand = New 
OleDb.OleDbCommand("Select * from Key_Category ", conn)
            Dim dr As OleDb.OleDbDataReader
            Dim strval As String
            dr = Selectcat.ExecuteReader()
            Do While dr.Read
                Dim newlistitem As New ListItem
                newlistitem.Value = dr.GetString(1)
                DDLCategory.Items.Add(newlistitem)

            Loop
            dr.Close()
            Response.Write("<div id=r1>")
            Response.Write("<select name='hidlevel' 
visibility='hidden'>")
            Dim Selectsubcat As New OleDb.OleDbCommand("Select * from 
Category order by KeyCatName,CatName ", conn)
            Dim sdr As OleDb.OleDbDataReader
            sdr = Selectsubcat.ExecuteReader
            Do While sdr.Read
                strval = sdr.Item("KeyCatName") & "--" & 
sdr.Item("CatName")
                Response.Write("<option value=strval>")
                Response.Write(sdr.GetString(1))
                Response.Write("</option>")
            Loop
        End If

    End Sub





-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to