I have built a web front end in ASP.NET that ties into a database used to capture information from varies servers. The front end uses a datagrid to display the data from the database.
The front end also includes drop downs and text boxes that the user enters in criteria to be searched on. When the dataset is returned and displayed based on the criteria entered into the form I would to be able to edit fields returned. The issue I'm having is that the criteria(SQL statement) isn't being kept if I want to edit a certain recordset returned after criteria is submitted.
What happens is that when clicking the edit button for a particular recordset it is returning the original resultset without the criteria entered.
I do not have this issue @ home on my laptop. Everything works like I would like it to. The query is kept through all states until the user clicks the clear button. The only difference I have seen is that my work machine setup has IE 6 and my home machine has IE7. Does anyone have any suggestions.... I have posted the code below to assist......
Again this same exact code works @ home but doesn't work the same @ work.... only known difference through research is that the browser is different versions..... IE 6 at work IE 7 at home....
I removed HTML, update, and datagrid code (too many characters)
javascript:insert_smilie('')
mad
<%@ Page enableViewState="True" SmartNavigation="True" enableViewStateMac="True" CodeBehind="AllinOne.aspx.vb" Language="vb" AutoEventWireup="true" Inherits="CentralData.AllinOne" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Data" %>
<HTML>
<HEAD>
</HEAD>
<meta content="False" name="vs_snapToGrid">
<meta content="False" name="vs_showGrid">
<script language="javascript">
function kH(e)
{
var pK = e e.which : window.event.keyCode;
return pK != 13;
}
document.onkeypress = kH;
if (document.layers)
document.captureEvents(Event.KEYPRESS);
</script>
<SCRIPT language="vb" runat="server">
' PAGE LOAD
Sub Page_Load(sender as Object, e as EventArgs)
If Not Page.IsPostBack then
ViewState("SortDirection") = "ASC"
ViewState("SortExpr") = "server_id"
BindData(ViewState("SortExpr"))
PopulateDropDownBoxes()
Response.Write("<b><font color=green>PageIndex:" & dgTECR.CurrentPageIndex & "</font><br>")
Response.Write("Page Count:<font color=purple>" & dgTECR.PageCount & "</font><br>")
response.write("ViewState Page Load: <font color=gray>" & ViewState("SortExpr") & "<BR></font>")
response.write("EditItemIndex Page Load: " & dgTECR.EditItemIndex & "<BR>")
Else
Button1.Enabled = False
server_name.Enabled = False
criticality.Enabled = False
environment.Enabled = False
apps_desc.Enabled = False
apps_end_user.Enabled = False
apps_group_sponsor.Enabled = False
apps_main_contact.Enabled = False
apps_it_contact.Enabled = False
apps_name.Enabled = False
apps_interface.Enabled = False
End if
End Sub
'END PAGE LOAD
'SUBMIT BUTTON
Sub SubmitBtn_Click (Src As Object, Args As EventArgs)
'Response.Write(Page.IsPostBack)
BindData(ViewState("SortExpr"))
response.write("ViewState: <font color=gray>" & ViewState("SortExpr") & "<BR></font>")
response.write("EditItemIndex: " & dgTECR.EditItemIndex & "<BR>")
'Response.Write("<b><font color=red>PageIndex:" & dgTECR.CurrentPageIndex & "</font><br>")
'Response.Write("Page Count:<font color=red>" & dgTECR.PageCount & "</font><br>")
End Sub
'END SUBMIT BUTTON
'CLEAR FORM
Sub ClearForm (Src As Object, Args As EventArgs)
'dgTECR.PageCount = 0
dgTECR.CurrentPageIndex = 0
Button1.Enabled = True
apps_desc.Enabled = True
apps_end_user.Enabled = True
apps_group_sponsor.Enabled = True
apps_main_contact.Enabled = True
apps_it_contact.Enabled = True
apps_name.Enabled = True
apps_interface.Enabled = True
server_name.Enabled = True
criticality.Enabled = True
environment.Enabled = True
apps_desc.text = ""
apps_group_sponsor.SelectedIndex = 0
apps_it_contact.SelectedIndex = 0
apps_interface.SelectedIndex = 0
apps_main_contact.SelectedIndex = 0
apps_end_user.SelectedIndex = 0
apps_name.SelectedIndex = 0
server_name.SelectedIndex = 0
criticality.SelectedIndex = 0
environment.SelectedIndex = 0
Response.Write("<b><font color=brown size=15>PageIndex:" & dgTECR.CurrentPageIndex & "</font><br>")
Response.Write("Page Count:" & dgTECR.PageCount & "<br>")
End Sub
'END CLEAR FORM
'BIND DATA
Sub BindData(SortExpr as String)
'GET INFORMATION FROM COLUMNS
dim server_id
server_id = Request.Form("server_id")
'Response.Write(server_id & "<br>")
'dim database_id
'database_id = Request.Form("database_id")
'Response.Write(database_id & "<br>")
dim apps_name
apps_name = Request.Form("apps_name")
'Response.Write(apps_name & "<br>")
dim apps_end_user
apps_end_user = Request.Form("apps_end_user")
'Response.Write(apps_end_user & "<br>")
dim apps_group_sponsor
apps_group_sponsor = Request.Form("apps_group_sponsor")
'Response.Write(apps_group_sponsor & "<br>")
dim apps_main_contact
apps_main_contact = Request.Form("apps_main_contact")
'Response.Write(apps_main_contact & "<br>")
dim apps_it_contact
apps_it_contact = Request.Form("apps_it_contact")
'Response.Write(apps_it_contact & "<br>")
dim apps_desc
apps_desc = Request.Form("apps_desc")
'Response.Write(apps_desc & "<br>")
dim apps_interface
apps_interface = Request.Form("apps_interface")
'Response.Write(apps_interface & "<br>")
dim server_name
server_name = Request.Form("server_name")
'Response.Write(server_name & "<br>")
dim criticality
criticality = Request.Form("criticality")
'Response.Write(criticality & "<br>")
dim environment
environment = Request.Form("environment")
'Response.Write(environment & "<br>")
dim user_name
user_name = Request.ServerVariables("LOGON_USER")
Response.Write(user_name & "<br>")
dim host_name
host_name = Request.ServerVariables("REMOTE_HOST")
'Response.Write(host_name & "<br>")
'REMOTE_ADDR: <%=Request.ServerVariables("REMOTE_ADDR")%><br>
'REMOTE_HOST: <%=Request.ServerVariables("REMOTE_HOST")%><br>
'REMOTE_USER: <%=Request.ServerVariables("REMOTE_USER")%><br>
'REQUEST_METHOD: <%=Request.ServerVariables("REQUEST_METHOD")%><br>
'SERVER_NAME: <%=Request.ServerVariables("SERVER_NAME")%><br>
'SERVER_PORT: <%=Request.ServerVariables("SERVER_PORT")%><br>
'SERVER_PROTOCOL: <%=Request.ServerVariables("SERVER_PROTOCOL")%><br>
'SERVER_SOFTWARE: <%=Request.ServerVariables("SERVER_SOFTWARE")%><br>
'URL: <%=Request.ServerVariables("URL")%><br>
'1). Create a connection string
Dim objConn As New SqlConnection("Server=svr-sqladm2000;uid=WebCentralDataUser;pwd=centraldata;Database=dbadmin")
'2). Create a command object
Dim MyString As String
MyString = "SELECT * FROM server_apps_vw "
If server_name <> "" THEN
MyString = MyString & "WHERE server_name LIKE '%" & server_name & "%'"
If criticality <> "" THEN
MyString = MyString & " AND criticality LIKE '%" & criticality & "%'"
Elseif environment <> "" THEN
MyString = MyString & " AND environment LIKE '%" & environment & "%'"
Elseif apps_name <> "" THEN
MyString = MyString & " AND apps_name LIKE '%" & apps_name & "%'"
Elseif apps_end_user <> "" THEN
MyString = MyString & " AND apps_end_user LIKE '%" & apps_end_user & "%'"
Elseif apps_group_sponsor <> "" THEN
MyString = MyString & " AND apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_main_contact <> "" THEN
MyString = MyString & " AND apps_main_contact LIKE '%" & apps_main_contact & "%'"
Elseif apps_it_contact <> "" THEN
MyString = MyString & " AND apps_it_contact LIKE '%" & apps_it_contact & "%'"
Elseif apps_desc <> "" THEN
MyString = MyString & " AND apps_desc LIKE '%" & apps_desc & "%'"
Elseif apps_interface <> "" THEN
MyString = MyString & " AND apps_interface LIKE '%" & apps_interface & "%'"
End if
ElseIf criticality <> "" THEN
MyString = MyString & "WHERE criticality LIKE '%" & criticality & "%'"
If server_name <> "" THEN
MyString = MyString & " AND server_name LIKE '%" & server_name & "%'"
Elseif environment <> "" THEN
MyString = MyString & " AND environment LIKE '%" & environment & "%'"
Elseif apps_name <> "" THEN
MyString = MyString & " AND apps_name LIKE '%" & apps_name & "%'"
Elseif apps_end_user <> "" THEN
MyString = MyString & " AND apps_end_user LIKE '%" & apps_end_user & "%'"
Elseif apps_group_sponsor <> "" THEN
MyString = MyString & " AND apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_main_contact <> "" THEN
MyString = MyString & " AND apps_main_contact LIKE '%" & apps_main_contact & "%'"
Elseif apps_it_contact <> "" THEN
MyString = MyString & " AND apps_it_contact LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_desc <> "" THEN
MyString = MyString & " AND apps_desc LIKE '%" & apps_desc & "%'"
Elseif apps_interface <> "" THEN
MyString = MyString & " AND apps_interface LIKE '%" & apps_interface & "%'"
End if
ElseIf environment <> "" THEN
MyString = MyString & "WHERE environment LIKE '%" & environment & "%'"
If server_name <> "" THEN
MyString = MyString & " AND server_name LIKE '%" & server_name & "%'"
Elseif criticality <> "" THEN
MyString = MyString & " AND criticality LIKE '%" & criticality & "%'"
Elseif apps_name <> "" THEN
MyString = MyString & " AND apps_name LIKE '%" & apps_name & "%'"
Elseif apps_end_user <> "" THEN
MyString = MyString & " AND apps_end_user LIKE '%" & apps_end_user & "%'"
Elseif apps_group_sponsor <> "" THEN
MyString = MyString & " AND apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_main_contact <> "" THEN
MyString = MyString & " AND apps_main_contact LIKE '%" & apps_main_contact & "%'"
Elseif apps_it_contact <> "" THEN
MyString = MyString & " AND apps_it_contact LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_desc <> "" THEN
MyString = MyString & " AND apps_desc LIKE '%" & apps_desc & "%'"
Elseif apps_interface <> "" THEN
MyString = MyString & " AND apps_interface LIKE '%" & apps_interface & "%'"
End if
ElseIf apps_name <> "" THEN
MyString = MyString & "WHERE apps_name LIKE '%" & apps_name & "%'"
If server_name <> "" THEN
MyString = MyString & " AND server_name LIKE '%" & server_name & "%'"
Elseif criticality <> "" THEN
MyString = MyString & " AND criticality LIKE '%" & criticality & "%'"
Elseif environment <> "" THEN
MyString = MyString & " AND environment LIKE '%" & environment & "%'"
Elseif apps_end_user <> "" THEN
MyString = MyString & " AND apps_end_user LIKE '%" & apps_end_user & "%'"
Elseif apps_group_sponsor <> "" THEN
MyString = MyString & " AND apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_main_contact <> "" THEN
MyString = MyString & " AND apps_main_contact LIKE '%" & apps_main_contact & "%'"
Elseif apps_it_contact <> "" THEN
MyString = MyString & " AND apps_it_contact LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_desc <> "" THEN
MyString = MyString & " AND apps_desc LIKE '%" & apps_desc & "%'"
Elseif apps_interface <> "" THEN
MyString = MyString & " AND apps_interface LIKE '%" & apps_interface & "%'"
End if
ElseIf apps_end_user <> "" THEN
MyString = MyString & "WHERE apps_end_user LIKE '%" & apps_end_user & "%'"
If server_name <> "" THEN
MyString = MyString & " AND server_name LIKE '%" & server_name & "%'"
Elseif criticality <> "" THEN
MyString = MyString & " AND criticality LIKE '%" & criticality & "%'"
Elseif environment <> "" THEN
MyString = MyString & " AND environment LIKE '%" & environment & "%'"
Elseif apps_name <> "" THEN
MyString = MyString & " AND apps_name LIKE '%" & apps_name & "%'"
Elseif apps_group_sponsor <> "" THEN
MyString = MyString & " AND apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_main_contact <> "" THEN
MyString = MyString & " AND apps_main_contact LIKE '%" & apps_main_contact & "%'"
Elseif apps_it_contact <> "" THEN
MyString = MyString & " AND apps_it_contact LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_desc <> "" THEN
MyString = MyString & " AND apps_desc LIKE '%" & apps_desc & "%'"
Elseif apps_interface <> "" THEN
MyString = MyString & " AND apps_interface LIKE '%" & apps_interface & "%'"
End if
ElseIf apps_interface <> "" THEN
MyString = MyString & "WHERE apps_interface LIKE '%" & apps_interface & "%'"
If server_name <> "" THEN
MyString = MyString & " AND server_name LIKE '%" & server_name & "%'"
Elseif criticality <> "" THEN
MyString = MyString & " AND criticality LIKE '%" & criticality & "%'"
Elseif apps_name <> "" THEN
MyString = MyString & " AND apps_name LIKE '%" & apps_name & "%'"
Elseif apps_end_user <> "" THEN
MyString = MyString & " AND apps_end_user LIKE '%" & apps_end_user & "%'"
Elseif apps_group_sponsor <> "" THEN
MyString = MyString & " AND apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_main_contact <> "" THEN
MyString = MyString & " AND apps_main_contact LIKE '%" & apps_main_contact & "%'"
Elseif apps_it_contact <> "" THEN
MyString = MyString & " AND apps_it_contact LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_desc <> "" THEN
MyString = MyString & " AND apps_desc LIKE '%" & apps_desc & "%'"
Elseif environment <> "" THEN
MyString = MyString & " AND environment LIKE '%" & environment & "%'"
End if
ElseIf apps_main_contact <> "" THEN
MyString = MyString & "WHERE apps_main_contact LIKE '%" & apps_main_contact & "%'"
If server_name <> "" THEN
MyString = MyString & " AND server_name LIKE '%" & server_name & "%'"
Elseif criticality <> "" THEN
MyString = MyString & " AND criticality LIKE '%" & criticality & "%'"
Elseif apps_name <> "" THEN
MyString = MyString & " AND apps_name LIKE '%" & apps_name & "%'"
Elseif apps_end_user <> "" THEN
MyString = MyString & " AND apps_end_user LIKE '%" & apps_end_user & "%'"
Elseif apps_group_sponsor <> "" THEN
MyString = MyString & " AND apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
Elseif environment <> "" THEN
MyString = MyString & " AND environment LIKE '%" & environment & "%'"
Elseif apps_it_contact <> "" THEN
MyString = MyString & " AND apps_it_contact LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_desc <> "" THEN
MyString = MyString & " AND apps_desc LIKE '%" & apps_desc & "%'"
Elseif apps_interface <> "" THEN
MyString = MyString & " AND apps_interface LIKE '%" & apps_interface & "%'"
End if
ElseIf apps_desc <> "" THEN
MyString = MyString & "WHERE apps_desc LIKE '%" & apps_desc & "%'"
If server_name <> "" THEN
MyString = MyString & " AND server_name LIKE '%" & server_name & "%'"
Elseif criticality <> "" THEN
MyString = MyString & " AND criticality LIKE '%" & criticality & "%'"
Elseif apps_name <> "" THEN
MyString = MyString & " AND apps_name LIKE '%" & apps_name & "%'"
Elseif apps_end_user <> "" THEN
MyString = MyString & " AND apps_end_user LIKE '%" & apps_end_user & "%'"
Elseif apps_group_sponsor <> "" THEN
MyString = MyString & " AND apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_main_contact <> "" THEN
MyString = MyString & " AND apps_main_contact LIKE '%" & apps_main_contact & "%'"
Elseif apps_it_contact <> "" THEN
MyString = MyString & " AND apps_it_contact LIKE '%" & apps_group_sponsor & "%'"
Elseif environment <> "" THEN
MyString = MyString & " AND environment LIKE '%" & environment & "%'"
Elseif apps_interface <> "" THEN
MyString = MyString & " AND apps_interface LIKE '%" & apps_interface & "%'"
End if
ElseIf apps_it_contact <> "" THEN
MyString = MyString & "WHERE apps_it_contact LIKE '%" & apps_it_contact & "%'"
If server_name <> "" THEN
MyString = MyString & " AND server_name LIKE '%" & server_name & "%'"
Elseif criticality <> "" THEN
MyString = MyString & " AND criticality LIKE '%" & criticality & "%'"
Elseif apps_name <> "" THEN
MyString = MyString & " AND apps_name LIKE '%" & apps_name & "%'"
Elseif apps_end_user <> "" THEN
MyString = MyString & " AND apps_end_user LIKE '%" & apps_end_user & "%'"
Elseif apps_group_sponsor <> "" THEN
MyString = MyString & " AND apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_main_contact <> "" THEN
MyString = MyString & " AND apps_main_contact LIKE '%" & apps_main_contact & "%'"
Elseif environment <> "" THEN
MyString = MyString & " AND environment LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_desc <> "" THEN
MyString = MyString & " AND apps_desc LIKE '%" & apps_desc & "%'"
Elseif apps_interface <> "" THEN
MyString = MyString & " AND apps_interface LIKE '%" & apps_interface & "%'"
End if
ElseIf apps_group_sponsor <> "" THEN
MyString = MyString & "WHERE apps_group_sponsor LIKE '%" & apps_group_sponsor & "%'"
If server_name <> "" THEN
MyString = MyString & " AND server_name LIKE '%" & server_name & "%'"
Elseif criticality <> "" THEN
MyString = MyString & " AND criticality LIKE '%" & criticality & "%'"
Elseif apps_name <> "" THEN
MyString = MyString & " AND apps_name LIKE '%" & apps_name & "%'"
Elseif apps_end_user <> "" THEN
MyString = MyString & " AND apps_end_user LIKE '%" & apps_end_user & "%'"
Elseif environment <> "" THEN
MyString = MyString & " AND environment LIKE '%" & environment & "%'"
Elseif apps_main_contact <> "" THEN
MyString = MyString & " AND apps_main_contact LIKE '%" & apps_main_contact & "%'"
Elseif apps_it_contact <> "" THEN
MyString = MyString & " AND apps_it_contact LIKE '%" & apps_group_sponsor & "%'"
Elseif apps_desc <> "" THEN
MyString = MyString & " AND apps_desc LIKE '%" & apps_desc & "%'"
Elseif apps_interface <> "" THEN
MyString = MyString & " AND apps_interface LIKE '%" & apps_interface & "%'"
End if
End if
MyString = MyString & " ORDER BY " & ViewState("SortExpr").ToString() & " " & ViewState("SortDirection").ToString()
Response.Write("<font color=red>" & MyString & "<br></font>")
Dim MyCommand As New SqlCommand(MyString, objConn)
'3). Create a DataAdapter
Dim MyDataAdapter As New SqlDataAdapter()
MyDataAdapter.SelectCommand = MyCommand
objConn.open()
'4). Populate the Dataset
Dim MyDataSet as DataSet = New DataSet()
MyDataAdapter.Fill(MyDataset, "server_apps_vw")
ViewState.Add("Central", MyDataSet)
'Response.Write("<b><font color=blue>PageIndex:" & dgTECR.CurrentPageIndex & "</font><br>")
'Response.Write("Page Count:<font color=green>" & dgTECR.PageCount & "</font><br>")
'Finally specify the datasource to bind
dgTECR.DataSource = ViewState("Central")
dgTECR.DataBind()
ShowPageInformation()
objConn.Close()
End Sub
'END BIND DATA
'PAGECOUNT
Sub ShowPageInformation()
'THIS SUB DISPLAYS PAGING INFORMATION IN THE APPROPRIATE LABEL
lblPagingInfo.Text = "Displaying Page <font color=red><b>" & (dgTECR.CurrentPageIndex+1).ToString() & "</b></font> of <font color=red><b>" & dgTECR.PageCount & "</b></font>"
End Sub
'END PAGECOUNT
'PAGING
Sub dgTECR_Paging(sender as Object, e as DataGridPageChangedEventArgs)
'TURN OFF EDITING
dgTECR.EditItemIndex = -1
dgTECR.CurrentPageIndex = e.NewPageIndex
'Response.Write("<b><font color=yellow>PageIndex:" & dgTECR.CurrentPageIndex & "</font><br>")
dgTECR.CurrentPageIndex = e.NewPageIndex
BindData(ViewState("SortExpr"))
End Sub
'END PAGING
'SORTING
Sub dgTECR_Sorting(sender as Object, e as DataGridSortCommandEventArgs)
'SET THE SortExpr VIEWSTATE VARIABLE ACCORDINGLY
If e.SortExpression.ToString() = ViewState("SortExpr").ToString() Then
Select Case ViewState("SortDirection").ToString()
Case "ASC"
ViewState("SortDirection") = "DESC"
Case "DESC"
Viewstate("SortDirection") = "ASC"
End Select
Else
ViewState("SortExpr") = e.SortExpression
ViewState("SortDirection") = "DESC"
End if
'RESET THE DATA TO SHOW FIRST PAGE OF DATA
dgTECR.CurrentPageIndex = 0
'TURN OFF EDITING
dgTECR.EditItemIndex = -1
'BIND THE DATA
BindData(ViewState("SortExpr"))
End Sub
'END SORTING
'EDIT ROW
Sub dgTECR_EditRow(sender as Object, e as DataGridCommandEventArgs)
dgTECR.EditItemIndex = e.Item.ItemIndex
BindData(ViewState("SortExpr"))
'response.write(ViewState("SortExpr"))
response.write("EdiItemIndex:<font color=red>" & dgTECR.EditItemIndex)
End Sub
'END EDIT ROW
' CANCEL ROW
Sub dgTECR_CancelRow(sender as Object, e as DataGridcommandEventArgs)
dgTECR.EditItemIndex = -1
BindData(ViewState("SortExpr"))
End Sub
' END CANCEL ROW
' DELETE FROM THE apps_details TABLE
Sub dgTECR_DeleteRow(sender as Object, e as DataGridCommandEventArgs)
'TURN OF EDITING
dgTECR.EditItemIndex = -1
Dim TECR_id as string = dgTECR.DataKeys(e.Item.ItemIndex)
'DELETE FROM THE TABLE...
Dim strSQL as String
strSQL = "DELETE FROM servers_app_vw WHERE server_id = @server_idParam"
Const strConnString as String = "Server=svr-sqladm2000;uid=WebCentralDataUser;pwd=centraldata;Database=dbadmin"
Dim objConn as New SqlConnection(strConnString)
Dim MyCommand as New SqlCommand(strSQL, objConn)
Dim server_idParam as New SqlParameter("@server_idParam", SqlDbType.VarChar, 15)
server_idParam.Value = TECR_id
MyCommand.Parameters.Add(server_idParam)
'ISSUE THE SQL COMMAND
objConn.Open()
MyCommand.ExecuteNonQuery()
objConn.Close()
BindData(ViewState("SortExpr"))
End Sub
' END DELETE FROM THE apps_details
' ROWDATABOUND
Sub dgTECR_RowDataBound(sender as Object, e as DataGridItemEventArgs)
If e.Item.ItemType <> ListItemType.Header AND e.Item.ItemType <> ListItemType.Footer then
dim deleteButton as LinkButton = e.Item.Cells(1).Controls(0)
'WE CAN NOW ADD THE ON CLICK EVENT HANDLER
deleteButton.Attributes("onclick") = return confirm('Are you sure you want to delete the following record ');"
End if
End Sub
' END ROWDATABOUND
</SCRIPT>

Maintaining the Query Through States issues "WORKS @ HOME"
HarveyC123
William,
I appreciate your time to look at my code. I definitely will work on incorporating the sql query into a class. I will have to educate myself on how to do that exactly. Do you have any books that I could purchase to learn this method. I will also try your other idea of saving the results into session and use it from there....
The thing that boggles my mind with this issue is that it works fine on my laptop. The code I have posted is a little different but the concept is the same. Biggest difference is the two browsers are not the same one is 6 and the other is 7
gabo_uy
Well, if you put a breakpoint on BindData and specifically the line where you're creating the text, is it hit each time What I mean is have you verified it's being set If a handler wasn't being added or something of that sort, that line may not be getting called.
As an aside, do yourself a big favor and move that code to a separate class (the code that creates the sql statement). Parameterize the query. You can use WHERE Value = @MyParameter or @MyParameter IS NULL in many cases to code around the If/THen logic (I haven't really stepped through it but I believe you can use that method there. I have another idea though. It looks like you're hitting the db each time asort or anything is triggered. Why not store the DataTable in session/view and just re-use it instead of going back to the db each time Then you can just filter it and be done with most of this