Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 5th, 2005, 11:39 PM
Authorized User
 
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to naresh.net
Default dropdownlist problem

i m populating a datagrid from the database. it is populated accurately,but what i want is when i click on drop down list item then it should show the data according 2 the selected item. i m just un able 2 under stand that how 2 call DATABIND proc for the dropdown, as was called 4 all data in the page_load event.that is how 2 change datagrid's event ahen the dropdown list changes value...

 
Old July 5th, 2005, 11:49 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I am unclear to what you are asking. Do you want to populate the datagrid based on what was selected in the dropdown list?

 
Old July 6th, 2005, 02:53 AM
Authorized User
 
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to naresh.net
Default

yes, i want the same u r saying..., but i m unable 2 understand the problem where i m lacking.



'''''DataBind Function

Sub BindAllData()
        strRMSConn = "server=C2M2;database=genx;uid=sa;password=sqlserv er;"
        strSql = "SELECT new_n_riskid RiskID, new_v_project Project, new_v_severity Severity, new_v_usrid IdentifiedBy, new_d_identify Date, new_v_rtitle RiskTitle FROM rm_new_risk" 'funSelectAll(Session("SessPrjName")) 'NARESH
        sqlConn = New System.Data.SqlClient.SqlConnection(strRMSConn)
        objDA = New System.Data.SqlClient.SqlDataAdapter(strSql, strRMSConn)
        objDA.Fill(objDS)
        Dim intAllRcdCount As Integer
        intAllRcdCount = objDS.Tables(0).Rows.Count.ToString()
        intResultCount = intAllRcdCount
        lblRecordCount.Text = "<b>" & intAllRcdCount & " Records Found"
        dgList.DataSource = objDS
        dgList.DataBind()
        sqlConn.Close()
        lblPageCount.Text = "Page " & dgList.CurrentPageIndex + 1 & " of " & dgList.PageCount
    End Sub

'''''Page_Load

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not Page.IsPostBack Then
            'Drop Down List for Project Name
            Ds_prjname1.Clear()
            SqlDataAdapter2.Fill(Ds_prjname1)
            ddlPrjName.DataBind()
            'Drop Down List for User ID's
            Ds_userid1.Clear()
            SqlDataAdapter3.Fill(Ds_userid1)
            ddlIdentifyBy.DataBind()

            BindAllData()
        End If

    End Sub

''''''DataGrid

Public Sub dgList_PageIndexChanged(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs) Handles dgList.PageIndexChanged
        dgList.CurrentPageIndex = e.NewPageIndex
        BindAllData()
    End Sub

'''''' Public Sub ddlPrjName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim Str As String
        strstr = ddlPrjName.SelectedValue
        strRMSConn = "server=C2M2;database=genx;uid=sa;password=sqlserv er;"
        Str = "SELECT new_n_riskid RiskID, new_v_project Project, new_v_severity Severity, new_v_usrid IdentifiedBy, new_d_identify Date, new_v_rtitle RiskTitle FROM rm_new_risk where new_v_project=" & strstr
        sqlPrjConn = New System.Data.SqlClient.SqlConnection(strRMSConn)
        objPrjDA = New System.Data.SqlClient.SqlDataAdapter(Str, strRMSConn)
        objPrjDA.SelectCommand.CommandText = Str
        objPrjDA.Fill(objPrjDs)
        dgList.DataSource = objPrjDs
        dgList.DataMember = "rm_new_risk"
        dgList.DataBind()
        sqlConn.Close()
    End Sub



 
Old July 6th, 2005, 08:37 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

So what is the problem you are having? The code looks fine, are you getting an error.

 
Old July 7th, 2005, 01:22 AM
Authorized User
 
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to naresh.net
Default

the problem is that i m neither getting any error nor i m able to display the data, when the grid is clicked and the value is changed. but on the page load it works fine, showing all data.







Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in dropdownlist premnaath ASP.NET 2.0 Professional 2 November 29th, 2007 10:01 AM
Dropdownlist Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 2 November 11th, 2006 09:24 AM
DropDownList Problem cmw231 ASP.NET 2.0 Professional 0 July 14th, 2006 08:44 AM
Problem with dropdownlist somnath.kartic ASP.NET 1.0 and 1.1 Basics 3 February 8th, 2006 01:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.