 |
| 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
|
|
|
|

June 22nd, 2005, 01:42 AM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
DataGrid's hyperlink and customized col Problem
hi all,
i m having problem with how to make a datagrid customized while fetching data into the datagrid from SQL table. i also have make 2 columns hyperlink of total 6 columns. 1 column contains different entries say "EMPLOYEE_ID", when i click on any "ID", it should display only that particular record. it also has a column named severity having values LOW, MEDIUM, HIGH, ALL. when i select any 1 value say "MEDIUM", then it sholud daiplay only those records, whose severity is "MEDIUM". severity is selected from a 'DropDownList' and then clicking a "GO" button. moreover 'DropDownList' sholud display "MEDIUM" when displaying records 4 severity "MEDIUM".
otherwise on page load it should display total records on "page_load".
i need code on this problem can anybody help. my mail id is [email protected]
thanks
Naresh
|
|

June 22nd, 2005, 12:46 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Is this question relating to how to show the hyperlinks in the grid or how to do what you need in the pages that are linked to?
- Peter
|
|

June 23rd, 2005, 03:11 AM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi Peter,
let me be very clear.
i have 2 fetch all data from the SQL table, when the page loads, into the datagrid, which has 6 columns. col1 is EMP_ID (unique n Primary Key, number type).i have 2 make entries of this col as hyperlinks, so that when any EMP_ID is clicked, then datagrid sholud show only that particuler record. and col4 is SEVERITY (varchar type), having values HIGH,MEDIUM,LOW,ALL. these values are provided in a dDropDownList just above the col. with this col what i have 2 do is, when i change value of DropDownList say i choose LOW, then datagrid should display only records that has SEVERITY as LOW.
i need code on this problem can anybody help. my mail id is [email protected]
Thanks
Naresh
|
|

June 23rd, 2005, 10:18 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
I sounds like what you need to do is change one of the hyperlink columns to a buttoncolumn (you can set the button type to linkbutton). This column will cause a postback where you can process the event and rebind the grid with the appropriate filter in place. You need to use the ItemCommand event from the grid.
The dropdownlist will just need to cause a postback where you can handle the SelectedIndexChanged event of the DDL. Grab the value from the DDL and apply the filter to your data, then rebind the grid.
- Peter
|
|

June 27th, 2005, 11:32 PM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi Peter,
i m attaching the code below, plz help me...
1 more problem in this is that when i change the datagrid's value taht is populated from the database, it takes only the TOP value. what i need is here as in this form i chose the another page from the dropdownlist, then as soon as i select another page,displays that no page, i want that kind of thing...
thanks and regards
Naresh Dlapath
+919818653169
'''''''THE CODE
Public Class SearchList
Inherits System.Web.UI.Page
Dim strSql, strSqlPrjName, strSqlSeverity, strSqlUserID As String
Dim strRMSConn As String
Dim sqlConn As System.Data.SqlClient.SqlConnection
Dim objDA As System.Data.SqlClient.SqlDataAdapter
Dim objDS As New System.Data.DataSet
Dim intResultCount As Integer
Dim intCount As Integer
Dim strResult As String
Dim intRiskID As Integer
Dim strPrjName, strSeverity, strUserBy, strRiskTitle As String
Dim datIdentify As String
Dim datFinal As String
Protected WithEvents dgList As System.Web.UI.WebControls.DataGrid
Protected WithEvents SqlDataAdapter2 As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents SqlSelectCommand2 As System.Data.SqlClient.SqlCommand
Protected WithEvents Ds_prjname1 As RiskManagementSystem.ds_prjname
Protected WithEvents SqlDataAdapter3 As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents SqlSelectCommand3 As System.Data.SqlClient.SqlCommand
Protected WithEvents Ds_userid1 As RiskManagementSystem.ds_userid
Protected WithEvents ddIdentifyBy As System.Web.UI.WebControls.DropDownList
Protected WithEvents lblRecordCount As System.Web.UI.WebControls.Label
Protected WithEvents lblPageCount As System.Web.UI.WebControls.Label
Protected WithEvents btnGo As System.Web.UI.WebControls.Button
Protected WithEvents txtDate As System.Web.UI.WebControls.TextBox
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Dim objSqlConn As RiskManagementSystem.RMSCommonLib.Connect
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.Ds_SearchListEdit1 = New RiskManagementSystem.Ds_SearchListEdit
Me.SqlDataAdapter2 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlSelectCommand2 = New System.Data.SqlClient.SqlCommand
Me.Ds_prjname1 = New RiskManagementSystem.ds_prjname
Me.SqlDataAdapter3 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlSelectCommand3 = New System.Data.SqlClient.SqlCommand
Me.Ds_userid1 = New RiskManagementSystem.ds_userid
CType(Me.Ds_SearchListEdit1, System.ComponentModel.ISupportInitialize).BeginIni t()
CType(Me.Ds_prjname1, System.ComponentModel.ISupportInitialize).BeginIni t()
CType(Me.Ds_userid1, System.ComponentModel.ISupportInitialize).BeginIni t()
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "rm_new_risk", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("new_n_riskid ", "new_n_riskid"), New System.Data.Common.DataColumnMapping("new_v_projec t", "new_v_project"), New System.Data.Common.DataColumnMapping("new_v_severi ty", "new_v_severity"), New System.Data.Common.DataColumnMapping("new_v_usrid" , "new_v_usrid"), New System.Data.Common.DataColumnMapping("new_d_identi fy", "new_d_identify"), New System.Data.Common.DataColumnMapping("new_v_rtitle ", "new_v_rtitle")})})
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO rm_new_risk(new_v_project, new_v_severity, new_v_usrid, new_d_identif" & _
"y, new_v_rtitle) VALUES (@new_v_project, @new_v_severity, @new_v_usrid, @new_d_i" & _
"dentify, @new_v_rtitle); SELECT new_n_riskid, new_v_project, new_v_severity, new" & _
"_v_usrid, new_d_identify, new_v_rtitle FROM rm_new_risk"
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_v_project ", System.Data.SqlDbType.VarChar, 20, "new_v_project"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_v_severit y", System.Data.SqlDbType.VarChar, 10, "new_v_severity"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_v_usrid", System.Data.SqlDbType.VarChar, 20, "new_v_usrid"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_d_identif y", System.Data.SqlDbType.DateTime, 8, "new_d_identify"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_v_rtitle" , System.Data.SqlDbType.VarChar, 50, "new_v_rtitle"))
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "workstation id=C2M2;packet size=4096;user id=sa;Password=sqlserver;data source=C2" & _
"M2;persist security info=False;initial catalog=genx"
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT new_n_riskid, new_v_project, new_v_severity, new_v_usrid, new_d_identify, " & _
"new_v_rtitle FROM rm_new_risk"
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
'
'Ds_SearchListEdit1
'
Me.Ds_SearchListEdit1.DataSetName = "Ds_SearchListEdit"
Me.Ds_SearchListEdit1.Locale = New System.Globalization.CultureInfo("en-US")
'
'SqlDataAdapter2
'
Me.SqlDataAdapter2.SelectCommand = Me.SqlSelectCommand2
Me.SqlDataAdapter2.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "rm_prj_name", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("prj_v_prjnam e", "prj_v_prjname")})})
'
'SqlSelectCommand2
'
Me.SqlSelectCommand2.CommandText = "SELECT prj_v_prjname FROM rm_prj_name"
Me.SqlSelectCommand2.Connection = Me.SqlConnection1
'
'Ds_prjname1
'
Me.Ds_prjname1.DataSetName = "ds_prjname"
Me.Ds_prjname1.Locale = New System.Globalization.CultureInfo("en-US")
'
'SqlDataAdapter3
'
Me.SqlDataAdapter3.SelectCommand = Me.SqlSelectCommand3
Me.SqlDataAdapter3.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "rm_usr_user", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("usr_v_userid ", "usr_v_userid")})})
'
'SqlSelectCommand3
'
Me.SqlSelectCommand3.CommandText = "SELECT usr_v_userid FROM rm_usr_user"
Me.SqlSelectCommand3.Connection = Me.SqlConnection1
'
'Ds_userid1
'
Me.Ds_userid1.DataSetName = "ds_userid"
Me.Ds_userid1.Locale = New System.Globalization.CultureInfo("en-US")
CType(Me.Ds_SearchListEdit1, System.ComponentModel.ISupportInitialize).EndInit( )
CType(Me.Ds_prjname1, System.ComponentModel.ISupportInitialize).EndInit( )
CType(Me.Ds_userid1, System.ComponentModel.ISupportInitialize).EndInit( )
End Sub
Protected WithEvents imgTlogo As System.Web.UI.WebControls.Image
Protected WithEvents lblRMS As System.Web.UI.WebControls.Label
Protected WithEvents txtRiskID As System.Web.UI.WebControls.TextBox
Protected WithEvents hLnkRID As System.Web.UI.WebControls.HyperLink
Protected WithEvents ddPrjName As System.Web.UI.WebControls.DropDownList
Protected WithEvents hLnkPrj As System.Web.UI.WebControls.HyperLink
Protected WithEvents ddSeverity As System.Web.UI.WebControls.DropDownList
Protected WithEvents hLnkSeverity As System.Web.UI.WebControls.HyperLink
Protected WithEvents hLnkIdentify As System.Web.UI.WebControls.HyperLink
Protected WithEvents hLnkOnDate As System.Web.UI.WebControls.HyperLink
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents hLnkRTitle As System.Web.UI.WebControls.HyperLink
Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Protected WithEvents Ds_SearchListEdit1 As RiskManagementSystem.Ds_SearchListEdit
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindData()
End If
End Sub
Sub BindData()
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"
sqlConn = New System.Data.SqlClient.SqlConnection(strRMSConn)
objDA = New System.Data.SqlClient.SqlDataAdapter(strSql, strRMSConn)
objDA.Fill(objDS)
Dim intRcdCount As Integer
intRcdCount = objDS.Tables(0).Rows.Count.ToString()
intResultCount = intRcdCount
lblRecordCount.Text = "<b>" & intRcdCount & " Records Found"
dgList.DataSource = objDS
dgList.DataBind()
sqlConn.Close()
lblPageCount.Text = "Page " & dgList.CurrentPageIndex + 1 & " of " & dgList.PageCount
End Sub
Sub dgList_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
dgList.CurrentPageIndex = e.NewPageIndex
BindData()
End Sub
Private Sub ddPrjName_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddPrjName.Load
Ds_prjname1.Clear()
SqlDataAdapter2.Fill(Ds_prjname1)
ddPrjName.DataBind()
End Sub
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
'there is a text box where if i type any entry from the list say TITLE and then
'i click on btnGO then it should display all those records that records having that
'TITLE.
End Sub
Public Function funSelectAll(ByVal prjname As String) As String
Dim strstr As String = prjname
strstr = ddPrjName.SelectedValue
Dim strRetAll As String
'strRetAll = "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"
strRetAll = "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 + "'"
Response.Write(strRetAll)
Return strRetAll
End Function
Private Sub ddPrjName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddPrjName.SelectedIndexChanged
'what should come here as i m populating it from database
End Sub
End Class
|
|

June 28th, 2005, 06:55 AM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi Peter,
here r some changes i mad eto the code but still not working..
''''''''THE CODE
Public Class SearchList
Inherits System.Web.UI.Page
Dim strSql, strSqlPrjName, strSqlSeverity, strSqlUserID As String
Dim strRMSConn As String
Dim sqlConn As System.Data.SqlClient.SqlConnection
Dim objDA As System.Data.SqlClient.SqlDataAdapter
Dim objDS As New System.Data.DataSet
Dim intResultCount As Integer
Dim intCount As Integer
Dim strResult As String
Dim intRiskID As Integer
Dim strPrjName, strSeverity, strUserBy, strRiskTitle As String
Dim datIdentify As String
Dim datFinal As String
'new
Dim strstr As String
Protected WithEvents dgList As System.Web.UI.WebControls.DataGrid
Protected WithEvents SqlDataAdapter2 As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents SqlSelectCommand2 As System.Data.SqlClient.SqlCommand
Protected WithEvents Ds_prjname1 As RiskManagementSystem.ds_prjname
Protected WithEvents SqlDataAdapter3 As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents SqlSelectCommand3 As System.Data.SqlClient.SqlCommand
Protected WithEvents Ds_userid1 As RiskManagementSystem.ds_userid
Protected WithEvents ddIdentifyBy As System.Web.UI.WebControls.DropDownList
Protected WithEvents lblRecordCount As System.Web.UI.WebControls.Label
Protected WithEvents lblPageCount As System.Web.UI.WebControls.Label
Protected WithEvents btnGo As System.Web.UI.WebControls.Button
Protected WithEvents txtDate As System.Web.UI.WebControls.TextBox
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Dim objSqlConn As RiskManagementSystem.RMSCommonLib.Connect
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.Ds_SearchListEdit1 = New RiskManagementSystem.Ds_SearchListEdit
Me.SqlDataAdapter2 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlSelectCommand2 = New System.Data.SqlClient.SqlCommand
Me.Ds_prjname1 = New RiskManagementSystem.ds_prjname
Me.SqlDataAdapter3 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlSelectCommand3 = New System.Data.SqlClient.SqlCommand
Me.Ds_userid1 = New RiskManagementSystem.ds_userid
CType(Me.Ds_SearchListEdit1, System.ComponentModel.ISupportInitialize).BeginIni t()
CType(Me.Ds_prjname1, System.ComponentModel.ISupportInitialize).BeginIni t()
CType(Me.Ds_userid1, System.ComponentModel.ISupportInitialize).BeginIni t()
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "rm_new_risk", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("new_n_riskid ", "new_n_riskid"), New System.Data.Common.DataColumnMapping("new_v_projec t", "new_v_project"), New System.Data.Common.DataColumnMapping("new_v_severi ty", "new_v_severity"), New System.Data.Common.DataColumnMapping("new_v_usrid" , "new_v_usrid"), New System.Data.Common.DataColumnMapping("new_d_identi fy", "new_d_identify"), New System.Data.Common.DataColumnMapping("new_v_rtitle ", "new_v_rtitle")})})
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO rm_new_risk(new_v_project, new_v_severity, new_v_usrid, new_d_identif" & _
"y, new_v_rtitle) VALUES (@new_v_project, @new_v_severity, @new_v_usrid, @new_d_i" & _
"dentify, @new_v_rtitle); SELECT new_n_riskid, new_v_project, new_v_severity, new" & _
"_v_usrid, new_d_identify, new_v_rtitle FROM rm_new_risk"
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_v_project ", System.Data.SqlDbType.VarChar, 20, "new_v_project"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_v_severit y", System.Data.SqlDbType.VarChar, 10, "new_v_severity"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_v_usrid", System.Data.SqlDbType.VarChar, 20, "new_v_usrid"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_d_identif y", System.Data.SqlDbType.DateTime, 8, "new_d_identify"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@new_v_rtitle" , System.Data.SqlDbType.VarChar, 50, "new_v_rtitle"))
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "workstation id=C2M2;packet size=4096;user id=sa;Password=sqlserver;data source=C2" & _
"M2;persist security info=False;initial catalog=genx"
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT new_n_riskid, new_v_project, new_v_severity, new_v_usrid, new_d_identify, " & _
"new_v_rtitle FROM rm_new_risk"
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
'
'Ds_SearchListEdit1
'
Me.Ds_SearchListEdit1.DataSetName = "Ds_SearchListEdit"
Me.Ds_SearchListEdit1.Locale = New System.Globalization.CultureInfo("en-US")
'
'SqlDataAdapter2
'
Me.SqlDataAdapter2.SelectCommand = Me.SqlSelectCommand2
Me.SqlDataAdapter2.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "rm_prj_name", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("prj_v_prjnam e", "prj_v_prjname")})})
'
'SqlSelectCommand2
'
Me.SqlSelectCommand2.CommandText = "SELECT prj_v_prjname FROM rm_prj_name"
Me.SqlSelectCommand2.Connection = Me.SqlConnection1
'
'Ds_prjname1
'
Me.Ds_prjname1.DataSetName = "ds_prjname"
Me.Ds_prjname1.Locale = New System.Globalization.CultureInfo("en-US")
'
'SqlDataAdapter3
'
Me.SqlDataAdapter3.SelectCommand = Me.SqlSelectCommand3
Me.SqlDataAdapter3.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "rm_usr_user", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("usr_v_userid ", "usr_v_userid")})})
'
'SqlSelectCommand3
'
Me.SqlSelectCommand3.CommandText = "SELECT usr_v_userid FROM rm_usr_user"
Me.SqlSelectCommand3.Connection = Me.SqlConnection1
'
'Ds_userid1
'
Me.Ds_userid1.DataSetName = "ds_userid"
Me.Ds_userid1.Locale = New System.Globalization.CultureInfo("en-US")
CType(Me.Ds_SearchListEdit1, System.ComponentModel.ISupportInitialize).EndInit( )
CType(Me.Ds_prjname1, System.ComponentModel.ISupportInitialize).EndInit( )
CType(Me.Ds_userid1, System.ComponentModel.ISupportInitialize).EndInit( )
End Sub
Protected WithEvents imgTlogo As System.Web.UI.WebControls.Image
Protected WithEvents lblRMS As System.Web.UI.WebControls.Label
Protected WithEvents txtRiskID As System.Web.UI.WebControls.TextBox
Protected WithEvents hLnkRID As System.Web.UI.WebControls.HyperLink
Protected WithEvents ddPrjName As System.Web.UI.WebControls.DropDownList
Protected WithEvents hLnkPrj As System.Web.UI.WebControls.HyperLink
Protected WithEvents ddSeverity As System.Web.UI.WebControls.DropDownList
Protected WithEvents hLnkSeverity As System.Web.UI.WebControls.HyperLink
Protected WithEvents hLnkIdentify As System.Web.UI.WebControls.HyperLink
Protected WithEvents hLnkOnDate As System.Web.UI.WebControls.HyperLink
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents hLnkRTitle As System.Web.UI.WebControls.HyperLink
Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Protected WithEvents Ds_SearchListEdit1 As RiskManagementSystem.Ds_SearchListEdit
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
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)
ddPrjName.DataBind()
'Drop Down List for User ID's
Ds_userid1.Clear()
SqlDataAdapter3.Fill(Ds_userid1)
ddIdentifyBy.DataBind()
BindData()
End If
End Sub
Sub BindData()
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 intRcdCount As Integer
intRcdCount = objDS.Tables(0).Rows.Count.ToString()
intResultCount = intRcdCount
lblRecordCount.Text = "<b>" & intRcdCount & " Records Found"
dgList.DataSource = objDS
dgList.DataBind()
sqlConn.Close()
lblPageCount.Text = "Page " & dgList.CurrentPageIndex + 1 & " of " & dgList.PageCount
End Sub
Public Sub dgList_PageIndexChanged(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs) Handles dgList.PageIndexChanged
dgList.CurrentPageIndex = e.NewPageIndex
BindData()
End Sub
Public Function funSelectAll(ByVal prjname As String) As String
Dim strstr As String = prjname
strstr = ddPrjName.SelectedValue
Dim strRetAll As String
'strRetAll = "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"
strRetAll = "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 + "'"
Response.Write(strRetAll)
Return strRetAll
End Function
Public Sub ddPrjName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddPrjName.SelectedIndexChanged
Dim Str As String
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=" & ddPrjName.SelectedValue
SqlDataAdapter2.Fill(Ds_prjname1)
dgList.DataSource = Ds_prjname1
dgList.DataBind()
'ddPrjName.SelectedIndex = ddPrjName.Items.IndexOf(ddPrjName.Items.FindByValu e("new_v_project"))
'Response.Write(ddPrjName.SelectedIndex)
End Sub
End Class
|
|

June 28th, 2005, 08:25 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Naresh,
I don't have the time to proof read your code. I'm more than happy to answer specific question or help understand what a specific error means, but I can't just read all your code and figure out what the problem is. Please provide more detail as to what is not working and the error message returned (if any). Also, please limit your posts to code that is relevant to the issue at hand. This will help you find a solution to your problem and minimize the number of posts like mine.
- Peter
|
|

June 28th, 2005, 10:58 PM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Peter,
the problem i m facing is that when i change the dropdwonlist value and try to print the changed index value, it always gives me the first index=0, its not changing. and also tell me how to--when i change the value of the DDL, then on its changeindex event it should display the data for that particular value.
the query i wrote is-------
Public Sub ddlPrjName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddPrjName.SelectedIndexChanged
Dim Str As String
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=" & ddlPrjName.SelectedValue
SqlDataAdapter2.Fill(Ds_prjname1)
dgList.DataSource = Ds_prjname1
dgList.DataBind()
End Sub
plz tell if what is wrong, as there is no error msg.
|
|

June 29th, 2005, 04:52 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Where are you setting the datasources for the DDLs? I see a few calls regarding the DDLs but nothing setting the datasource. The only place ddlPrjName appears is in the event handler for it.
I did just notice that "Handles ddPrjName.SelectedIndexChanged" seems to be missing a letter.
- Peter
|
|

June 30th, 2005, 07:23 AM
|
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi Peter,
all that was done at PageLoad.
'''''DDL is populated here and data in the DDL is visible.
Ds_prjname1.Clear()
SqlDataAdapter2.Fill(Ds_prjname1)
ddPrjName.DataBind()
''''''''DDL
Public Sub ddlPrjName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlPrjName.SelectedIndexChanged
Dim Str As String
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=" & ddlPrjName.SelectedValue
SqlDataAdapter2.Fill(Ds_prjname1)
dgList.DataSource = Ds_prjname1
dgList.DataBind()
End Sub
even after this the problem remains the same.
-Naresh
+919818653169
|
|
 |