Free Download:
|
| |
| Charles Asborns | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/23/2007 7:35:00 PM |
0/0 | |
|
I have a GV in a ContentPlaceholder in a master page with all sorts of bells and whistles and it works fine. How do you reference your master page in the content page's code? Do you have any of the GV code in the master page codebehind instead of the content page codebehind?
May all your posts be enlightening... Charlie Asbornsen Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. |
| Charles Asborns | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/23/2007 7:35:24 PM |
0/0 | |
|
And I have about 20 session variables.
May all your posts be enlightening... Charlie Asbornsen Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. |
| flaron | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/23/2007 8:02:14 PM |
0/0 | |
|
My masterpage does not contain any code for the Gridview. When the Menu Item "Home" is chosen a content page is loaded. I do not reference the masterpage in this content page except from the page tag and the gridview code is in the content page codebehind. I used Session Parameters at first to load the gridview but another post said to use Control Parameters so I switched and get the same results. The code for both the master and content follows. The content now uses controls to load the gridview and uses a mutliview switch from the gridview to a edit section. I am probably missing something simple but can't seem to find out what.
The Masterpage follows <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>H.O.P.E.</title>
<link href="layout.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div id="header">
<asp:ImageButton ID="DOHlogo" runat="server" ImageAlign="Right"
ImageUrl="~/images/doh_logo.gif" ToolTip="Florida Department of Health" TabIndex="3" />
<span id="hope">HMS Online Production Enhancement</span><br />
<asp:Label ID="dateTimeLabel" runat="server" ForeColor="Black" Text="DateTime" Font-Size="12px" ToolTip="Date" TabIndex="1"></asp:Label><br />
<asp:Label ID="lblLoginUser" runat="server" Text="user" ToolTip="User Name" TabIndex="2"></asp:Label></div>
<div id="body" style="top: 89px; height: 509px">
<div id="nav">
<asp:Menu ID="Menu" runat="server" StaticEnableDefaultPopOutImage="False">
<Items>
<asp:MenuItem Text="Home" Value="Home" NavigateUrl="~/editticket.aspx" ToolTip="Home"></asp:MenuItem>
<asp:MenuItem Text="New Ticket" Value="New Ticket" NavigateUrl="~/ticket.aspx" ToolTip="New Ticket"></asp:MenuItem>
<asp:MenuItem Text="Admin" Value="Admin" NavigateUrl="~/admin.aspx" ToolTip="Admin"></asp:MenuItem>
<asp:MenuItem Text="Reports" Value="Reports" NavigateUrl="~/reports.aspx" ToolTip="Reports"></asp:MenuItem>
</Items>
<StaticMenuItemStyle BackColor="Maroon" Font-Bold="True" ForeColor="White" Height="30px"
ItemSpacing="20px" Width="70px" />
<StaticSelectedStyle Font-Bold="True" />
<StaticItemTemplate>
<%#Eval("Text")%>
</StaticItemTemplate>
<StaticHoverStyle BackColor="Maroon" BorderStyle="None" Font-Bold="True" Font-Italic="False"
ForeColor="#FFFFAA" />
</asp:Menu>
</div>
<div id="content">
<asp:contentplaceholder id="mainContent" runat="server">
</asp:contentplaceholder>
</div>
</div>
</form>
</body>
</html> The Content page follows <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" SmartNavigation="true" CodeFile="editticket.aspx.vb" Inherits="editticket" title="H.O.P.E." %>
<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" Runat="Server">
<h2 style="text-align: center">
</h2>
<asp:CheckBox ID="viewAll" runat="server" Text="Please check to view all tickets"
AutoPostBack="True" Width="330px"/>
<asp:Label ID="lblUserCurr" runat="server" >Current User Is: </asp:Label>
<asp:Label ID="lblUser" runat="server" ></asp:Label>
<asp:MultiView ID="multiView1" runat="server">
<asp:View ID="viewEmpty" runat="server">
</asp:View>
<asp:View ID="viewList" runat="server">
<asp:GridView ID="GridView1" runat="server" OnRowCommand="row_editTicket" AutoGenerateColumns="False"
CellPadding="4" DataSourceID="ObjectDataSource1"
ForeColor="#333333" GridLines="None" AllowSorting="True"
Font-Size="10pt" ToolTip="Tickets" AllowPaging="True"
Font-Names="Tahoma" EnableSortingAndPagingCallbacks="true" >
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:ButtonField ButtonType="Button" CommandName="editTicket" Text="Edit">
<ItemStyle Width="20px" />
</asp:ButtonField>
<asp:BoundField DataField="TicketNO" HtmlEncode="False" HeaderText="Ticket #" SortExpression="TicketNO">
<ItemStyle Width="20px" />
</asp:BoundField>
<asp:BoundField DataField="DateSubmitted" DataFormatString="{0:d}" HtmlEncode="False" HeaderText="Date Submitted" SortExpression="DateSubmitted">
<ItemStyle Width="35px" />
</asp:BoundField>
<asp:BoundField DataField="HMSArea" HeaderText="HMS Subject" SortExpression="HMSArea">
<ItemStyle Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status">
<ItemStyle Width="20px" />
</asp:BoundField>
<asp:BoundField DataField="CQTicket" HeaderText="CQ Ticket" NullDisplayText="None Assigned" SortExpression="CQTicket">
<ItemStyle Width="20px" />
</asp:BoundField>
<asp:BoundField DataField="ProblemDesc" HeaderText="Problem Description" NullDisplayText="Unknown">
<ItemStyle Width="120px" />
</asp:BoundField>
<asp:BoundField DataField="SubmitedBY" NullDisplayText="Unknown" HeaderText="Submitted By" SortExpression="SubmitedBY" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="ReturnUsersTicket"
TypeName="HopeDataLib.LoadTable">
<SelectParameters>
<asp:ControlParameter ControlID="lblUser" Name="userId" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="viewAll" DefaultValue="False" Name="Checked" PropertyName="Checked"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</asp:View>
<asp:View ID="viewTicket" runat="server">
<center>
<table id="ticket">
<tr><td colspan="2"></td></tr>
<tr>
<td style="height: 21px">
Ticket:
<asp:Label ID="ticketID" runat="server" Text="#" ToolTip="Ticket Number"></asp:Label></td>
<td align="left" style="height: 21px; width: 50%;">
Date Submitted:
<asp:Label ID="dateSubmitted" runat="server" Text="date" ToolTip="Date Submitted"></asp:Label></td>
</tr>
<tr>
<td>
Created by:
<asp:Label ID="createdID" runat="server" Text="Name" ToolTip="Created By"></asp:Label></td>
<td style="width: 50%">
County:
<asp:Label ID="countyID" runat="server" Text="county" ToolTip="County"></asp:Label></td>
</tr>
<tr>
<td>
</td>
<td style="width: 50%">
HMS Subject Area:
<asp:DropDownList ID="subjectArea" runat="server" ToolTip="HMS Subject Area">
</asp:DropDownList></td>
</tr>
<tr>
<td colspan="2" style="height: 159px">
Problem Description:<br />
<asp:TextBox ID="probDesc" runat="server" Height="100px" Width="450px" ToolTip="Problem Description" TextMode="MultiLine"></asp:TextBox><br />
Attachment:
<asp:FileUpload ID="Attachment" runat="server" ToolTip="Attachment" />
<asp:HyperLink ID="viewAttach" runat="server" Font-Size="10px" Font-Underline="True" ForeColor="Blue" Target="_blank" ToolTip="View Attachment">View Attachment</asp:HyperLink><br />
<br />
<asp:Button ID="btnSaveTicket" runat="server" Text="Save Ticket" ToolTip="Save Ticket" />
<br />
<asp:Label ID="lblError" runat="server" Text="Label" Width="432px" ForeColor="Red" ToolTip="Error Message"></asp:Label></td>
</tr>
</table>
</center>
<br />
<center><hr /></center>
<br />
<center>
<table id="SIG">
<tr>
<td style="height: 23px">
SIG Responsible:
<asp:DropDownList ID="drpSigResponsible" runat="server" ToolTip="SIG Responsible"></asp:DropDownList></td>
<td style="height: 23px">
Request Status:
<asp:DropDownList ID="drpStatus" runat="server" ToolTip="Request Status">
</asp:DropDownList></td>
</tr>
<tr>
<td style="height: 24px">
</td>
<td style="height: 24px">
SIG Priority:
<asp:DropDownList ID="drpPriority" runat="server" ToolTip="SIG Priority">
</asp:DropDownList></td>
</tr>
<tr>
<td colspan="2">
Comments:<br />
<asp:TextBox ID="SIGcomments" runat="server" Height="100px" Width="450px" Wrap="False" ToolTip="Comments" TextMode="MultiLine"></asp:TextBox><br />
<asp:CheckBox ID="approved" runat="server" ToolTip="Approval" />Steering Body Approved<br />
<br />
<asp:Button ID="btnSaveSig" runat="server" Text="Save SIG" ToolTip="Save SIG" /></td>
</tr>
</table>
</center>
<br />
<center><hr /></center>
<br />
<center>
<table id="CQ">
<tr>
<td align="left">
CQ Ticket #:
<asp:TextBox ID="CQid" runat="server" ToolTip="CQ Ticket" ></asp:TextBox>
</td>
<td align="left">
Date CQ Entered:
<asp:TextBox ID="dateCQ" runat="server" ToolTip="CQ Date"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
Assigned to Release:
<asp:DropDownList ID="drpRelease" runat="server" AutoPostBack="true" ToolTip="Release Assigned">
</asp:DropDownList></td>
<td align="left">
Scheduled Release Date:
<asp:Label ID="releaseDate" runat="server" Text="date" ToolTip="Scheduled Release Date"></asp:Label></td>
</tr>
<tr>
<td align="left" colspan="2">
Release Notes:<br />
<asp:TextBox ID="releaseNotes" runat="server" Height="100px" Width="450px" ToolTip="Release Notes" TextMode="MultiLine"></asp:TextBox><br />
<asp:CheckBox ID="notifyUser" runat="server" />
Notify user of changes<br />
<br />
<asp:Button ID="btnSaveCQ" runat="server" Text="Save CQ" ToolTip="Save CQ" /></td>
</tr>
</table>
</center>
</asp:View>
</asp:MultiView>
</asp:Content>
|
| Charles Asborns | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/23/2007 8:18:42 PM |
0/0 | |
|
In the page declaration of the masterpage (the top line), try adding AutoEventWireup="true". Also you have AutoEventWireup set to false on the content page - was wireup causing a problem for you?
May all your posts be enlightening... Charlie Asbornsen Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. |
| flaron | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/23/2007 8:26:36 PM |
0/0 | |
|
Can't say if wireup is the problem or not. But I tried changing it and got the same results.
|
| Charles Asborns | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/23/2007 8:51:59 PM |
0/0 | |
|
Well its 5PM here so I gotta go, but I'llcheck back tomorrow. Do you have VB for this too? I'm not a VB guy but I can generally muddle through.
May all your posts be enlightening... Charlie Asbornsen Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. |
| flaron | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/24/2007 1:07:28 PM |
0/0 | |
|
Here is the codebehind for the master and content pages. The master page just gets data from active directory stores it in Session variables or updates a data base user table.
Thanks for having a look.
Master Page
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles dateTimeLabel.Load
dateTimeLabel.Text = DateTime.Now.ToString()
Dim i As Integer
Dim UserName As String
lblLoginUser.Text = My.User.Name
UserName = My.User.Name
i = UserName.IndexOf("\")
Session("UserName") = Right(UserName, UserName.Length - 1 - i)
GetAD(Session("UserName"))
Session("Checked") = "0"
Me.Menu.Items(1).Enabled = False
Me.Menu.Items(2).Enabled = False
Me.Menu.Items(3).Enabled = False
Session("Rights") = AddCheckUser()
Select Case Session("Rights")
Case "E"
Me.Menu.Items(1).Enabled = True
Me.Menu.Items(3).Enabled = True
Case "V"
Me.Menu.Items(3).Enabled = True
Me.mainContent.Visible = False
Case "S"
Me.Menu.Items(1).Enabled = True
Me.Menu.Items(3).Enabled = True
Case "H"
Me.Menu.Items(1).Enabled = True
Me.Menu.Items(3).Enabled = True
Case "A"
Me.Menu.Items(1).Enabled = True
Me.Menu.Items(2).Enabled = True
Me.Menu.Items(3).Enabled = True
End Select
End Sub
Private Function AddCheckUser() As String
Dim reader As SqlDataReader
'Dim i As Integer
Dim UsrName As String = Session("UserName")
Dim Userobj As New HopeDataLib.Users
'If User.IsInRole("HPEall") Then
'"HMSBillingSIG"
'"DLHMSCCGENERIC"
'"DLHMSDentalSIG"
'"DLHMSCCHealthyStartSIG"
'"DLHMSCCHIV-AIDsSIG"
'"DLHMSCCTBSIG"
'"DLHMSImmunizationsSIG"
'"DLHMSLabSIG"
'"DLHMSStaff"
'"DLHMSReportingSIG"
'"DLHMSRegistration-SchedulingSIG"
'"DLHMSHMCSIG"
'End If
Userobj.UserID = Session("UserName")
Userobj.FullName = Session("ADname")
Userobj.CountyID = HopeDataLib.LoadTable.ReturnCountyID(Session("ADco"))
Userobj.PhoneNumber = Session("ADtelephoneNumber")
Userobj.SunCom = Session("ADotherTelephone")
Userobj.Email = Session("ADmail")
reader = Userobj.Save()
reader.Read()
AddCheckUser = reader("AccessRights")
End Function
Public Sub GetAD(ByVal UsrName As String)
'Dim i As Integer
Dim oroot As DirectoryServices.DirectoryEntry = New DirectoryServices.DirectoryEntry("LDAP://xxx.xxx.xxx")
oroot.AuthenticationType = AuthenticationTypes.Secure
oroot.Username = "HPEDATAACCT"
oroot.Password = "Data4All"
Dim osearcher As DirectoryServices.DirectorySearcher = New DirectoryServices.DirectorySearcher(oroot)
Dim oresult As DirectoryServices.SearchResultCollection
Dim result As DirectoryServices.SearchResult
' The default query is for the GSN unless otherwise specified.
Dim strQuery
If Request.QueryString.ToString = "" Then
strQuery = "(sAMAccountName=" & UsrName & ")"
Else
'Replace the IE "+" character with a space character again.
strQuery = Replace(Request.QueryString.ToString, "+", " ")
'Add the parenthesis for the SQL string
strQuery = "(" & strQuery & ")"
End If
osearcher.Filter = "(&(objectCategory=person)(objectClass=user)" & strQuery & ")" ' search filter
osearcher.PropertiesToLoad.Add("name") ' full name
osearcher.PropertiesToLoad.Add("department") ' department
osearcher.PropertiesToLoad.Add("telephoneNumber") ' phone
osearcher.PropertiesToLoad.Add("co") ' ou
osearcher.PropertiesToLoad.Add("otherTelephone") 'otherTelephone
osearcher.PropertiesToLoad.Add("mail") ' email
oresult = osearcher.FindAll()
For Each result In oresult
Session("ADname") = result.GetDirectoryEntry.Properties("name").Value ' full name
Session("ADotherTelephone") = result.GetDirectoryEntry.Properties("otherTelephone").Value ' phone
Session("ADtelephoneNumber") = result.GetDirectoryEntry.Properties("telephoneNumber").Value ' phone
Session("ADco") = result.GetDirectoryEntry.Properties("co").Value ' ou
Session("ADdepartment") = result.GetDirectoryEntry.Properties("department").Value ' ou
Session("ADmail") = result.GetDirectoryEntry.Properties("mail").Value ' ou
Next
oroot.Close()
End Sub
End Class
Content page Code Partial Class editticket
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack = True Then
Dim reader As SqlDataReader
lblError.Visible = False
lblUser.Text = Session("UserName")
If Session("Rights") = "V" Then
Me.multiView1.SetActiveView(viewEmpty)
Else
Me.multiView1.SetActiveView(viewList)
If Session("Rights") = "A" Or Session("Rights") = "S" Then
viewAll.Visible = True
Else
viewAll.Visible = False
End If
End If
reader = HopeDataLib.LoadTable.GetSIGs
subjectArea.DataSource = reader
subjectArea.DataTextField = "SIGTITLE"
subjectArea.DataValueField = "SIGCODE"
subjectArea.DataBind()
subjectArea.Items.Insert(0, New ListItem("Choose an HMS Area", "**"))
reader = HopeDataLib.LoadTable.GetStatus
drpStatus.DataSource = reader
drpStatus.DataTextField = "StatusTitle"
drpStatus.DataValueField = "StatusID"
drpStatus.DataBind()
drpStatus.Items.Insert(0, New ListItem("Choose a Status", "**"))
reader = HopeDataLib.LoadTable.GetPriority
drpPriority.DataSource = reader
drpPriority.DataTextField = "Priority"
drpPriority.DataValueField = "RecID"
drpPriority.DataBind()
drpPriority.Items.Insert(0, New ListItem("Choose a Priority", "**"))
reader = HopeDataLib.LoadTable.LoadReleases
drpRelease.DataSource = reader
drpRelease.DataTextField = "ReleaseVersion"
drpRelease.DataValueField = "RecID"
drpRelease.DataBind()
drpRelease.Items.Insert(0, New ListItem("Choose a Release", "**"))
reader = HopeDataLib.LoadTable.GetSIGs
drpSigResponsible.DataSource = reader
drpSigResponsible.DataTextField = "SIGTITLE"
drpSigResponsible.DataValueField = "SIGCODE"
drpSigResponsible.DataBind()
drpSigResponsible.Items.Insert(0, New ListItem("Choose SIG", "**"))
Else
lblError.Visible = False
If Session("Rights") = "E" Then
drpSigResponsible.Enabled = False
drpStatus.Enabled = False
drpPriority.Enabled = False
SIGcomments.Enabled = False
approved.Enabled = False
CQid.Enabled = False
dateCQ.Enabled = False
drpRelease.Enabled = False
releaseDate.Enabled = False
releaseNotes.Enabled = False
notifyUser.Enabled = False
ElseIf Session("Rights") = "S" Then
drpSigResponsible.Enabled = True
drpStatus.Enabled = True
drpPriority.Enabled = True
SIGcomments.Enabled = True
approved.Enabled = True
CQid.Enabled = False
dateCQ.Enabled = False
drpRelease.Enabled = False
releaseDate.Enabled = False
releaseNotes.Enabled = False
notifyUser.Enabled = False
ElseIf Session("Rights") = "A" Then
drpSigResponsible.Enabled = True
drpStatus.Enabled = True
drpPriority.Enabled = True
SIGcomments.Enabled = True
approved.Enabled = True
CQid.Enabled = True
dateCQ.Enabled = True
drpRelease.Enabled = True
releaseDate.Enabled = True
releaseNotes.Enabled = True
notifyUser.Enabled = True
End If
End If
End Sub
Public Sub PopADProblem()
createdID.Text = Session("ADname")
dateSubmitted.Text = Today.ToShortDateString
End Sub
Sub row_editTicket(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
If IsNumeric(e.CommandArgument) Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
' Get the last name of the selected author from the appropriate
' cell in the GridView control.
Dim selectedRow As GridViewRow = GridView1.Rows(index)
Dim ticketCell As TableCell = selectedRow.Cells(1)
Dim TicketNO As String = ticketCell.Text
' Read database and populate.
Problem_Ticket(TicketNO)
Sig_Ticket(TicketNO)
Release_Ticket(TicketNO)
Me.multiView1.SetActiveView(viewTicket)
End If
End Sub
Protected Sub Problem_Ticket(ByVal TicketNO As Integer)
Dim reader As SqlDataReader
Dim i As Integer
Dim UsrName As String = Session("UserName")
reader = HopeDataLib.Tickets.ReturnTicket(TicketNO)
If reader.Read Then
ticketID.Text = TicketNO
createdID.Text = reader("Name")
countyID.Text = reader("County")
dateSubmitted.Text = reader("DateSubmitted")
probDesc.Text = reader("ProblemDesc")
viewAttach.Enabled = True
viewAttach.NavigateUrl = "ViewAttachment.aspx?Ticket=" & TicketNO.ToString
For i = 0 To subjectArea.Items.Count - 1
If subjectArea.Items(i).Value = reader("HMSArea").ToString Then
subjectArea.Items(i).Selected = True
Else
subjectArea.Items(i).Selected = False
End If
Next
End If
reader.Close()
End Sub
Protected Sub Sig_Ticket(ByVal TicketNO As Integer)
Dim reader As SqlDataReader
Dim i As Integer
Dim SigTicket As New HopeDataLib.SIGTickets
SigTicket.TicketNO = TicketNO
reader = SigTicket.ReturnTickets
If reader.Read Then
SIGcomments.Text = reader("Comments")
For i = 0 To drpSigResponsible.Items.Count - 1
If drpSigResponsible.Items(i).Value = reader("ResponsibleSIG").ToString Then
drpSigResponsible.Items(i).Selected = True
Else
drpSigResponsible.Items(i).Selected = False
End If
Next
For i = 0 To drpPriority.Items.Count - 1
If drpPriority.Items(i).Value = reader("Priority").ToString Then
drpPriority.Items(i).Selected = True
Else
drpPriority.Items(i).Selected = False
End If
Next
For i = 0 To drpStatus.Items.Count - 1
If drpStatus.Items(i).Value = reader("Status").ToString Then
drpStatus.Items(i).Selected = True
Else
drpStatus.Items(i).Selected = False
End If
Next
End If
reader.Close()
End Sub
Protected Sub Release_Ticket(ByVal TicketNO As Integer)
Dim reader As SqlDataReader
Dim i As Integer
Dim Relticket As New HopeDataLib.ReleaseTickets
Relticket.TicketNO = TicketNO
reader = Relticket.ReturnTickets
If reader.Read Then
CQid.Text = reader("CQTicket")
dateCQ.Text = reader("CQDATE")
releaseDate.Text = reader("SchReleaseDate")
releaseNotes.Text = reader("ReleaseNotes")
'drpRelease
For i = 0 To drpRelease.Items.Count - 1
If drpRelease.Items(i).Value = reader("CQRelease").ToString Then
drpRelease.Items(i).Selected = True
Else
drpRelease.Items(i).Selected = False
End If
Next
End If
reader.Close()
End Sub
Protected Sub btnSaveTicket_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSaveTicket.Click
Dim bytenum As Integer
Dim UsrName As String = Session("UserName")
Dim AttUpdate As String
Dim dataerror As Boolean = False
Dim NewTicket As New HopeDataLib.Tickets
Dim fileExtension As String
fileExtension = ""
'*************
If Attachment.HasFile Then
bytenum = Attachment.PostedFile.InputStream.Length
AttUpdate = "Y"
Else
bytenum = 0
AttUpdate = "N"
End If
Dim imageBytes(bytenum) As Byte
If Attachment.HasFile Then
fileExtension = System.IO.Path.GetExtension(Attachment.FileName).ToLower()
Try
Attachment.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length)
lblError.Text = "File uploaded!"
'txtDescProblem.Text = fileProblem.PostedFile.FileName & " Attached to this Ticket " & txtDescProblem.Text
Catch ex As Exception
lblError.Text = "File could not be uploaded."
End Try
End If
'*************
NewTicket.TicketNo = ticketID.Text
NewTicket.UserID = UsrName
NewTicket.SubmitedBy = createdID.Text
NewTicket.HMSArea = subjectArea.SelectedItem.Value
NewTicket.ProblemDesc = probDesc.Text
NewTicket.DateSubmitted = dateSubmitted.Text
NewTicket.Attachment = imageBytes
NewTicket.AttUpdate = AttUpdate
NewTicket.mimeType = fileExtension
If subjectArea.SelectedItem.Value = "**" Then
dataerror = True
lblError.Text = "**No HMS Subject Area Selected"
End If
If probDesc.Text.Length = 0 Then
dataerror = True
lblError.Text = "**No Problem Description"
End If
If dataerror Then
lblError.Visible = True
Else
NewTicket.SaveChanges()
ClientScript.RegisterStartupScript(Me.GetType(), "LoadContent", "<SCRIPT LANGUAGE='javascript'>window.alert('Update Completed');</script>")
End If
Dim MsgText As String
MsgText = "Your HMS Ticket has been submitted/updated " & ControlChars.CrLf & ControlChars.CrLf & " The Ticket number is "
MsgText &= NewTicket.TicketNo.ToString & ControlChars.CrLf & ControlChars.CrLf & " Goto to this link to Edit http://hpe00swdev/HOPE/editticket.aspx"
MsgText &= " and choose this ticket number " & NewTicket.TicketNo.ToString
SendMail(HopeDataLib.SIGS.ReturnEmailAddress(subjectArea.SelectedItem.Value), MsgText, 1)
End Sub
Protected Sub btnSaveSig_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSaveSig.Click
Dim dataerror As Boolean = False
Dim Sig As New HopeDataLib.SIGTickets
lblError.Text = ""
Sig.TicketNO = ticketID.Text
Sig.ResponsibleSIG = drpSigResponsible.SelectedItem.Value
Sig.Priority = drpPriority.SelectedItem.Value
Sig.Status = drpStatus.SelectedItem.Value
Sig.DateUpdate = Today.ToShortDateString
Sig.Comments = SIGcomments.Text
If approved.Checked = True Then
Sig.sigApproved = "T"
Else
Sig.sigApproved = "F"
End If
If drpSigResponsible.SelectedItem.Value = "**" Then
dataerror = True
lblError.Text = "**No Responsible SIG Selected"
End If
If drpStatus.SelectedItem.Value = "**" Then
dataerror = True
lblError.Text = "**No Status Selected"
End If
If dataerror Then
lblError.Visible = True
Else
Sig.SaveChanges()
ClientScript.RegisterStartupScript(Me.GetType(), "LoadContent", "<SCRIPT LANGUAGE='javascript'>window.alert('Update Completed');</script>")
End If
Dim MsgText As String
MsgText = "Your HMS Ticket has been updated by the assigned SIG Group" & ControlChars.CrLf & ControlChars.CrLf & " The Ticket number is "
MsgText &= Sig.TicketNO.ToString & ControlChars.CrLf & ControlChars.CrLf & " Goto to this link to Edit http://hpe00swdev/HOPE/editticket.aspx"
MsgText &= " and choose this ticket number " & Sig.TicketNO.ToString
SendMail(HopeDataLib.SIGS.ReturnEmailAddress(drpSigResponsible.SelectedItem.Value), MsgText, 2)
ClientScript.RegisterStartupScript(Me.GetType(), "LoadContent", "<SCRIPT LANGUAGE='javascript'>window.alert('Update Completed');</script>")
End Sub
Protected Sub btnSaveCQ_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSaveCQ.Click
Dim dataerror As Boolean = False
Dim Release As New HopeDataLib.ReleaseTickets
Release.TicketNO = ticketID.Text
Release.CQTicket = CQid.Text
Release.CQDATE = dateCQ.Text
Release.CQRelease = drpRelease.SelectedItem.Value
Release.SchReleaseDate = releaseDate.Text
Release.ReleaseNotes = releaseNotes.Text
If notifyUser.Checked = True Then
Release.notifyUser = "T"
Else
Release.notifyUser = "F"
End If
If CQid.Text.Length = 0 Then
dataerror = True
lblError.Text = "**No CQ ticket entered"
End If
If dateCQ.Text.Length = 0 Then
dataerror = True
lblError.Text = "**No CQ Date Entered"
End If
If dataerror Then
lblError.Visible = True
Else
Release.SaveChanges()
ClientScript.RegisterStartupScript(Me.GetType(), "LoadContent", "<SCRIPT LANGUAGE='javascript'>window.alert('Update Completed');</script>")
End If
Dim MsgText As String
Dim UsrName As String = Session("UserName")
MsgText = "Your HMS Ticket has been Assigned a CQ Ticket " & ControlChars.CrLf & ControlChars.CrLf & " The Ticket number is "
MsgText &= Release.TicketNO.ToString & " and the CQ Ticket is " & CQid.Text & ControlChars.CrLf & ControlChars.CrLf & " Goto to this link to Edit http://hpe00swdev/HOPE/editticket.aspx"
MsgText &= " and choose this ticket number " & Release.TicketNO.ToString
Dim ticket As String
ticket = Release.TicketNO.ToString
SendMail(Release.ReturnUserEmail, MsgText, 3)
End Sub
Protected Sub drpRelease_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles drpRelease.SelectedIndexChanged
Dim release As New HopeDataLib.ReleaseTickets
Dim reader As SqlDataReader
release.Recid = drpRelease.SelectedItem.Value
reader = release.ReturnReleaseInfo
If reader.Read Then
releaseDate.Text = reader("ScheduleDate")
End If
reader.Close()
End Sub
Protected Sub SendMail(ByVal Email As String, ByVal MsgText As String, ByVal MailRoute As Integer)
Dim UsrName As String = Session("UserName")
Dim UserID As String
Dim reader As SqlDataReader
Dim user As New HopeDataLib.Users
user.UserID = UsrName
Session("SigUserID") = UsrName
reader = user.ReturnUserInfo
If reader.Read Then
Session("SigUserEmail") = reader("Email")
End If
Dim UserEmail As String
If MailRoute = 1 Then
UserEmail = HopeDataLib.Users.ReturnEmailAddress(UsrName)
UserID = UsrName
ElseIf MailRoute = 2 Then
UserEmail = Session("SigUserEmail")
UserID = Session("SigUserID")
Else
UserEmail = Email
Email = HopeDataLib.Users.ReturnEmailAddress(UsrName)
UserID = "Release"
End If
Session("SigUserEmail") = reader("Email")
Dim Msg As MailMessage = New MailMessage()
Dim MailObj As New SmtpClient("167.78.1.36")
Msg.From = New MailAddress("[email protected]", "H.O.P.E.")
Msg.To.Add(New MailAddress(UserEmail, UserID))
Msg.CC.Add(New MailAddress(Email, "SIG"))
Msg.IsBodyHtml = "False"
Msg.Body = MsgText
Msg.Subject = "H.O.P.E. Ticket System"
MailObj.Send(Msg)
End Sub
End Class
|
| Charles Asborns | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/24/2007 5:01:57 PM |
0/0 | |
|
Well, there's nothing obvious here. Is there any possibility it has something to do with permissions (since that is what got added in the masterpage)? You say it sorts and pages for the first databind but if you change something it loses paging and sorting capability? Are the links there - I mean, does your header have underlines and is your pager visible? When you say it doesn't work, do you mean nothing happens, or does it crash, or does it hang? Do you have a stylesheet attached to the master that is doing something funky maybe?
May all your posts be enlightening... Charlie Asbornsen Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. |
| flaron | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/24/2007 6:02:01 PM |
0/0 | |
|
Here how thing work. The default content page is loaded with the masterpage the user clicks the "HOME" menu choice. The gridview content page is loaded. The gridview has all the users entered tickets the sort and paging works here. If the users has certain Admin rights he will see a check box control which allow him to return all tickets. Once the box is checked it will postpack and refresh the gridview with all tickets. This does work I get the correct data in the gridview. The header are underlined like links the pager is visible but niether will function. If the users unchecks the checkbox the data changes in the gridview as it should but sort and pager still doesn't function.
There is a stylesheet attach to the masterpage, but what is a stylesheet will cause this.
Thanks for the look. |
| Charles Asborns | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/24/2007 6:48:32 PM |
0/0 | |
|
Check the styles you have for links - also see if it works if you hold down the Ctrl key and click to sort or page. The Header columns and the pager both use a kind of link and it may be that the stylesheet in your master (which gets applied to your content placeholder's content through the cascade) has caused a change in the behavior of your gridview.
May all your posts be enlightening... Charlie Asbornsen Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. |
| Charles Asborns | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/25/2007 1:16:15 PM |
0/0 | |
|
I'll do a test page later today and see if I can replicate the problem.
Maybe you should start a new project and just do the most basic gridview you can and then add it to a master where the only thing in it is a CPH. Get that working and start adding stuff from your project into it a piece at a time. If you get to a point where it breaks again, you'll know what is causing the problem.
May all your posts be enlightening... Charlie Asbornsen Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. |
| flaron | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/25/2007 1:25:43 PM |
0/0 | |
| |
| flaron | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/25/2007 2:53:28 PM |
0/0 | |
|
Thanks for lokking into this. I started a new WebSite and added to it in steps. And everything is working without any changes. Strange but it works now.
Thanks
Again |
| Charles Asborns | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/25/2007 3:37:51 PM |
0/0 | |
|
I love Visual Studio's little pecadillos...
May all your posts be enlightening... Charlie Asbornsen Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. |
| 208965 | Asp.Net User |
| GRIDVIEW not Sorting when used in MasterPage | 10/25/2007 5:47:34 PM |
0/0 | |
|
I don't have idea about sorting in grid. But i have experienced with paging. You have to handel pageindexxhanging event in vb code. I that after the statement e.pageIndex=e.NewPageIndex you have to again fill the grid with the same data.
For this you have to write fill grid as a seperate routine..
I am not sure that i had cleared your doubt. Any how try it out.
Thanks
Regards, Cute boy |
| 208965 | Asp.Net User |
| Re: GRIDVIEW not Sorting when used in MasterPage | 10/25/2007 6:02:25 PM |
0/0 | |
|
hoe to sort out data in the datagrid....
Regards, Cute boy |
|
| |
Free Download:
|
Books: ASP.NET 2.0 Instant Results Authors: Imar Spaanjaars, Paul Wilton, Shawn Livermore, Pages: 456, Published: 2006 Wrox's SQL Server 2005 Express Edition Starter Kit: Express Edition Starter Kit Authors: Rajesh George, Lance Delano, Pages: 353, Published: 2006 Pro C# 2005 and the .NET 2.0 Platform: Public Beta Edition Authors: Andrew W. Troelsen, Pages: 982, Published: 2005 Beginning ASP.NET 2.0 Databases: Beta Preview Authors: John Kauffman, Thiru Thangarathinam, Pages: 427, Published: 2005 C# for Programmers: Updated for C# 2.0 Authors: Paul J. Deitel, Pages: 1317, Published: 2005 Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008 Pro C# with .NET 3.0: exploring the .NET universe using curly brackets Authors: Andrew Troelsen, Pages: 1186, Published: 2007 Beginning ASP.NET 2.0 with C# Authors: Chris Hart, John Kauffman, David Sussman, Chris Ullman, Pages: 735, Published: 2006 Visual Basic 2005: How to Program Authors: Harvey M. Deitel, Pages: 1513, Published: 2006 Beginning ASP.NET 2.0 Authors: Chris Hart, John Kauffman, Chris Ullman, David Sussman, Pages: 759, Published: 2005 Web:GRIDVIEW not Sorting when used in MasterPage - ASP.NET Forums Re: GRIDVIEW not Sorting when used in MasterPage. 10-23-2007, 3:35 PM. Contact ... Re: GRIDVIEW not Sorting when used in MasterPage ... Gridview not working when trying to use Select Parameters and a ... I only face this problem when I'm using the gridview in conjunction with a master page. I do not have this problem when I'm using it on ... ASP.NET 2.0 Paging GridView in MasterPage not working in IE Also, the sorting works like a charm in both IE and Firefox, ... Paging GridView in MasterPage not working in IE - Eric Golpe 01-May-06 05:51 5:51:31 PM ... Master Page Gridview Export Excel The article did not mention where should this overrides call and what I have ... gridview needs sorting and paging) and found the error with my coding. Here ... CodeProject: ASP.NET GridView Extension [Client Side Sortable ... NET GridView control, with built-in client side sorting, column dragging, fixed header etc. .... Question, Problem while using with masterpages, member ... gridview sorting - Dot Net Search Engine swicki - powered by eurekster has anyone used this code with populating the gridview from a dataset? ... Nested MasterPage, Sorting Gridview, Update Delete Gridview, SiteMapPath Control , ... Gridview, using Callbacks when Sorting and Paging (VB GridView Paging and Sorting Callbacks example) has a callback example for gridview which explains that there should NOT be a page ... Master Pages :: Programmatic Interaction Between a Content Page ... Because the GridView in the master page. is not programmatically .... NET engine what master page is being used by our content page it generates a ... Migrating to the GridView and ObjectDataSource With the GridView, you get it free. Well, not in this case. Turn on sorting, click on a column header, and it gives you this (very helpful and descriptive, ... Extended GridView Control: ASP Alliance I used the sample of the dl section, but the Masterpage problem still .... Frankly speaking, I have thought Gridview is not better than Datagrid in ASP. ... |
|
Search This Site:
|
|