Click here to Skip to main content
15,902,299 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: GridView Problem.. Pin
Hirdesh Shrivastava19-Jul-07 0:06
Hirdesh Shrivastava19-Jul-07 0:06 
GeneralRe: GridView Problem.. Pin
DKalepu19-Jul-07 2:04
DKalepu19-Jul-07 2:04 
Questionwhat is App.ico in .net? Pin
vijay_8318-Jul-07 19:47
vijay_8318-Jul-07 19:47 
AnswerRe: what is App.ico in .net? Pin
RepliCrux18-Jul-07 19:53
RepliCrux18-Jul-07 19:53 
AnswerRe: what is App.ico in .net? Pin
Mubashir Javaid18-Jul-07 20:03
Mubashir Javaid18-Jul-07 20:03 
Questiondgresult.SelectedItem.Cells(1).Text Pin
n_gchaitra18-Jul-07 19:38
n_gchaitra18-Jul-07 19:38 
QuestionRe: dgresult.SelectedItem.Cells(1).Text Pin
RepliCrux18-Jul-07 19:48
RepliCrux18-Jul-07 19:48 
AnswerRe: dgresult.SelectedItem.Cells(1).Text Pin
n_gchaitra18-Jul-07 20:00
n_gchaitra18-Jul-07 20:00 
It is not giving any error. But just not working. As I know this property is used to select the value in a particular column and in fact it is working for me in other pages. But I could not figure it out why it is not working here. Here is the complete code.

Imports System.Web.Security
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Collections
Imports System.Data.SqlClient.SqlConnection
Partial Class Searchups
Inherits System.Web.UI.Page
Dim sqlstr As String
Dim vstr As String
Dim flag As Boolean
Dim constr As String = ConfigurationSettings.AppSettings("conn")
Dim dbconn As New SqlConnection(constr)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Txtasscd.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + Btnsearch.UniqueID + "').click();return false;}} else {return true}; ")
Ddl.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + Btnsearch.UniqueID + "').click();return false;}} else {return true}; ")
Ddmdl.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + Btnsearch.UniqueID + "').click();return false;}} else {return true}; ")
tbreg.Visible = False
tabdg.Visible = False
Calendar1.Visible = False
Calendar2.Visible = False
If Page.IsPostBack = False Then
bindmodel()
bindlocation()
bindoff()
increment()
bindmdl()
vstr = ViewState("vstr")
End If
End Sub
Sub bindmodel()
Dim sqlstr As String
sqlstr = "select model from a_upsmodel order by model"
Dim comm As New SqlCommand(sqlstr, dbconn)
Dim dr As SqlDataReader
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
dr = comm.ExecuteReader
While dr.Read
Ddmdl.Items.Add(dr.Item(0).ToString)
End While
dr.Close()
End Sub
Sub bindresult(ByVal sqlstr As String)
Dim ds As New DataSet()
Dim comm As New SqlDataAdapter(sqlstr, dbconn)
dgresult.DataSource = ds
comm.Fill(ds)
dgresult.DataBind()
'navi.Visible = True
'lblnopg.Text = dgresult.PageCount
End Sub
Sub bindlocation()
Dim sqlstr As String
sqlstr = "select location from a_location order by location"
Dim comm As New SqlCommand(sqlstr, dbconn)
Dim dr As SqlDataReader
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
dr = comm.ExecuteReader
While dr.Read
Ddl.Items.Add(dr.Item(0).ToString)
End While
dr.Close()
End Sub
Sub bindoff()
Dim sqlstr As String
sqlstr = "select location from a_location order by location"
Dim comm As New SqlCommand(sqlstr, dbconn)
Dim dr As SqlDataReader
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
dr = comm.ExecuteReader
While dr.Read
Ddoff.Items.Add(dr.Item(0).ToString)
End While
dr.Close()
End Sub
Sub bindmdl()

Dim sqlstr As String
sqlstr = "select model from a_upsmodel order by model"
Dim comm As New SqlCommand(sqlstr, dbconn)
Dim dr As SqlDataReader
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
dr = comm.ExecuteReader
While dr.Read
DDmodel.Items.Add(dr.Item(0).ToString)
End While
dr.Close()
End Sub

Sub increment()
Dim sqlstr4 As String
Dim dr4 As SqlClient.SqlDataReader
Dim comm As New SqlCommand()

sqlstr4 = "select uno from a_mstr_uno where regno=(select max(regno)from a_mstr_uno)"
Dim sqlcomm4 As New SqlClient.SqlCommand(sqlstr4, dbconn)
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
dr4 = sqlcomm4.ExecuteReader()
Dim vcd As String
While dr4.Read
vcd = dr4.Item("uno")
End While
dbconn.Close()
dr4.Close()
vcd = vcd
vcd = vcd.Substring(1)
vcd = CInt(vcd)

If (vcd >= 1 And vcd <= 9) Then
vcd = vcd + 1
Txtascd.Text = "U0" & vcd.ToString()
ElseIf (vcd >= 10 And vcd <= 99) Then
vcd = vcd + 1
Txtascd.Text = "U" & vcd.ToString()
End If
End Sub

Protected Sub Btnsearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btnsearch.Click
tabdg.Visible = True
If Txtasscd.Text.Trim = "'" Then
Txtasscd.Text = ""
Exit Sub
End If

dgresult.CurrentPageIndex = 0
ViewState.Remove("vstr")

If Txtasscd.Text.Trim <> "" Then
vstr = " and Assetcode like '" & Txtasscd.Text.Trim & "%'"
ViewState("vstr") = vstr
End If

If Ddmdl.SelectedIndex <> 0 Then
vstr = " and model='" & Ddmdl.SelectedItem.ToString() & "'"
ViewState("vstr") += vstr
End If

If Ddl.SelectedIndex <> 0 Then
vstr = " and location='" & Ddl.SelectedItem.ToString() & "'"
ViewState("vstr") += vstr
End If
vstr = ViewState("vstr")
sqlstr = "select a.AssetCode,a.SerialNumber,a.Model,'NoOfSystemsConnected'=a.NoOfSystems,a.Capacity,a.Location,a.Sub_Location,a.Status,a.Vendor,'Amc Date'=a.amc,'Wty Date'=Wty,a.Remarks from A_ups a,a_mstr_uno u where a.assetcode=u.uno" + vstr + " order by u.regno asc"
ViewState("sqlstr") = sqlstr
' bindresult(sqlstr)
If dgresult.AllowPaging = True Then
sqlstr = ViewState("sqlstr")
dgresult.AllowPaging = False
bindresult(sqlstr)
tabdg.Visible = True
Else
sqlstr = ViewState("sqlstr")
dgresult.AllowPaging = True
bindresult(sqlstr)
tabdg.Visible = True
End If
End Sub

Sub clear()
Ddoff.SelectedIndex = 0
Ddmdl.SelectedIndex = 0
Txtvendor.Text = ""
Txtnsys.Text = ""
Txtamc.Text = Now.Date
Txtwty.Text = Now.Date
Txtremark.Text = "Nil"
Txtcapacity.Text = ""
Txtlocation.Text = ""
txtslno.Text = ""
increment()
End Sub

Protected Sub btnsubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
tbreg.Visible = True
If Ddoff.SelectedIndex = 0 Then
lblmsg.Text = "Select the Location !"
lblmsg.ForeColor = Drawing.Color.Red
lblmsg.Visible = True
Exit Sub
End If
If (txtslno.Text = "") Then
lblmsg.Visible = True
lblmsg.ForeColor = Drawing.Color.Red
lblmsg.Text = "Enter Serial Number"
Exit Sub
End If

If DDmodel.SelectedIndex = 0 Then
lblmsg.Text = "Select the model !"
lblmsg.ForeColor = Drawing.Color.Red
lblmsg.Visible = True
Exit Sub
End If

Dim orderid As Integer
Dim sqlstr As String
Dim sqlstr1 As String
Dim dr As SqlDataReader
flag = False
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
sqlstr = "select regno from a_mstr_uno order by regno"
Dim comm2 As New SqlCommand(sqlstr, dbconn)
dr = comm2.ExecuteReader
While dr.Read
orderid = dr.Item(0)
End While
dr.Close()
dbconn.Close()
orderid = orderid + 1

sqlstr = "insert into a_ups (assetcode,Location,Sub_Location,serialnumber,vendor, model,amc,wty,capacity,Noofsystems,status,REMARKS) values ('" & Txtascd.Text.ToUpper() & "','" & Ddoff.SelectedItem.ToString() & "','" & Txtlocation.Text & "','" & txtslno.Text & "','" & Txtvendor.Text & "','" & Ddmdl.SelectedItem.ToString() & "','" & Txtamc.Text.Trim & "','" & Txtwty.Text.Trim & "','" & Txtcapacity.Text & "','" & Txtnsys.Text & "','" & DDstatus.SelectedItem.ToString() & "','" & Txtremark.Text & "')"
sqlstr1 = "insert into a_mstr_uno(Uno,regno,serialno)values('" & Txtascd.Text.Trim & "', '" & orderid & "','" & txtslno.Text.Trim & "')"

Dim comm As New SqlCommand(sqlstr, dbconn)
Dim comm1 As New SqlCommand(sqlstr1, dbconn)
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
Try
comm.ExecuteNonQuery()
comm1.ExecuteNonQuery()
lblmsg.Text = "Registered successfully !"
lblmsg.ForeColor = Drawing.Color.Green
lblmsg.Visible = True
clear()
Catch ex As Exception
lblmsg.Text = ex.ToString
' lblmsg.Text = "Could not save"
lblmsg.ForeColor = Drawing.Color.Red
lblmsg.Visible = True
End Try
End Sub

Protected Sub ImageButton2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click
tbreg.Visible = True
Calendar1.Visible = True
End Sub

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
Txtamc.Text = Calendar1.SelectedDate
Calendar1.Visible = False
tbreg.Visible = True
End Sub

Protected Sub ImageButton4_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton4.Click
Calendar2.Visible = True
tbreg.Visible = True
End Sub

Protected Sub Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar2.SelectionChanged
Txtwty.Text = Calendar2.SelectedDate
Calendar2.Visible = False
tbreg.Visible = True
End Sub

Protected Sub btncreate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncreate.Click
tbreg.Visible = True
End Sub

Protected Sub dgresult_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgresult.SelectedIndexChanged
Dim assetcode As String
assetcode = dgresult.SelectedItem.Cells(1).Text
Response.Redirect("Edit_UPS.aspx?assetcode=" + assetcode + " ")
End Sub
End Class



GeneralRe: dgresult.SelectedItem.Cells(1).Text Pin
RepliCrux18-Jul-07 20:10
RepliCrux18-Jul-07 20:10 
Questionprob in calling webservice from client side in javascript Pin
itzmevishu18-Jul-07 19:01
itzmevishu18-Jul-07 19:01 
Questiondeployment in asp.net Pin
Sonia Gupta18-Jul-07 18:25
Sonia Gupta18-Jul-07 18:25 
AnswerRe: deployment in asp.net Pin
Sylvester george18-Jul-07 18:39
Sylvester george18-Jul-07 18:39 
GeneralRe: deployment in asp.net Pin
Sonia Gupta18-Jul-07 19:14
Sonia Gupta18-Jul-07 19:14 
GeneralRe: deployment in asp.net Pin
Sylvester george18-Jul-07 19:19
Sylvester george18-Jul-07 19:19 
AnswerRe: deployment in asp.net Pin
N a v a n e e t h18-Jul-07 19:12
N a v a n e e t h18-Jul-07 19:12 
Questioncreate image gallery. Pin
Milind Panchal18-Jul-07 18:22
Milind Panchal18-Jul-07 18:22 
QuestionValue of type Byte cannot be converted to 1-dimensional array of Byte Pin
ASPnoob18-Jul-07 16:22
ASPnoob18-Jul-07 16:22 
AnswerRe: Value of type Byte cannot be converted to 1-dimensional array of Byte Pin
Sathesh Sakthivel18-Jul-07 16:31
Sathesh Sakthivel18-Jul-07 16:31 
GeneralRe: Value of type Byte cannot be converted to 1-dimensional array of Byte [modified] Pin
ASPnoob18-Jul-07 16:51
ASPnoob18-Jul-07 16:51 
QuestionIntelligence in VS 2005 Pin
Amit Kumar G18-Jul-07 15:06
Amit Kumar G18-Jul-07 15:06 
AnswerRe: Intelligence in VS 2005 Pin
Sylvester george18-Jul-07 18:15
Sylvester george18-Jul-07 18:15 
AnswerRe: Intelligence in VS 2005 Pin
Mubashir Javaid18-Jul-07 18:36
Mubashir Javaid18-Jul-07 18:36 
QuestionSingle Sign On for two sites of different domains. Pin
sandeep kumar pundhir18-Jul-07 11:46
sandeep kumar pundhir18-Jul-07 11:46 
AnswerRe: Single Sign On for two sites of different domains. Pin
RepliCrux18-Jul-07 12:45
RepliCrux18-Jul-07 12:45 
GeneralRe: Single Sign On for two sites of different domains. Pin
N a v a n e e t h18-Jul-07 19:31
N a v a n e e t h18-Jul-07 19:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.