[英]Can't find which method is being called by the button
我正在修改前雇員的代碼。 我是ASP.net甚至網絡編程的新手,代碼中沒有留下任何評論。 在其中一個表單中,按鈕是動態創建的,當單擊其中一個按鈕時,會打開一個包含信息的小表單。
現在我的問題是我不明白表單是如何打開的。
這是在SuiviPlanFormation.aspx
中創建按鈕的位置
<asp:Button ID="btnComplete" runat ="server" Text ="B212"
CommandArgument ='<%# Eval("Code") %>' CommandName ="Select"
CssClass="button"
Enabled='<%# not Eval("Status").equals("green") %>'/>
這是單擊B212按鈕FormationForm.aspx
時似乎打開的表單。 代碼顯然是從Page_Load
開始的。
我似乎無法弄清楚如何調用這種形式。 有人可以賜教嗎?
編輯SuiviPlanFormation.aspx
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="SuiviPlanFormation.aspx.vb" Inherits="SuiviPlanFormation" %>
<%@ Register Src="~/Controls/FormationForm.ascx" TagName ="FormationForm" TagPrefix ="uc1" %>
<%@ Register Src="~/Controls/SelectionForm.ascx" TagName ="SelectionForm" TagPrefix ="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Holder" Runat="Server">
<asp:UpdatePanel runat ="server" >
<ContentTemplate>
<cc1:AlwaysVisibleControlExtender ID="AlwaysVisibleControlExtender1" runat="server"
ScrollEffectDuration="0.1" HorizontalOffset="930" TargetControlID="pnlLegend"
VerticalOffset="20">
</cc1:AlwaysVisibleControlExtender>
<asp:Panel ID="pnlLegend" runat="server" Style="position : absolute ; visibility:visible ; top:20px; left:930px;">
<table border="0" cellpadding="0" cellspacing="0" style="border-style: solid; border-width: 1px;"
width="420px">
<tr>
<td class="accordionHeaderSmall" colspan="2" style="border-style: none; padding-top: 2px;
padding-bottom: 2px">
Légende
</td>
</tr>
<tr>
<td align="center" class="texte" style="width: 5%; background-color: InfoBackground;
padding-left: 2px;">
<img alt="GREEN" height="10px" src="../Images/IconSystem/Indicateur/green.gif" width="10px" /></td>
<td class="texte" style="width: 95%; background-color: InfoBackground;" align="left">
Formation valide</td>
</tr>
<tr>
<td align="center" class="texte" style="background-color: InfoBackground; padding-left: 2px;">
<img alt="Yellow" height="10px" src="../Images/IconSystem/Indicateur/Yellow.gif"
width="10px" /></td>
<td class="texte" style="background-color: InfoBackground;" align="left">
Formation non suivie, mais encore dans les délais de l'échéancier</td>
</tr>
<tr>
<td align="center" class="texte" style="background-color: InfoBackground; padding-left: 2px;">
<img alt="RED" height="10px" src="../Images/IconSystem/Indicateur/red.gif" width="10px" /></td>
<td class="texte" style="background-color: InfoBackground;" align="left">
Formation invalide : Le délai de l'échéancier ou la nouvelle mise en vigueur est expiré</td>
</tr>
</table>
</asp:Panel>
<table cellpadding="0" cellspacing="0" style="text-align: left; margin-left: 0; margin-top: 0;" width="98%" border="0">
<tr style="height: 10px"><td colspan="2"></td></tr>
<tr>
<td class="TexteSection" style="width:35%">
<asp:Label ID="lbTitre" runat="server" CssClass="texteSection" Text="Plan de formation"></asp:Label>
</td>
<td align="right" style="width:65%">
<asp:Label ID="lbMsgErreur" runat="server" EnableViewState="False"
CssClass="msgerreur" ForeColor="Red"></asp:Label></td>
</tr>
<tr style="height: 1px">
<td style="background-color: #F55443;" colspan="2">
</td>
</tr>
<tr><td colspan="2" style="height:5px;"></td></tr>
<tr><td colspan="2">
<asp:Panel ID="pnlFilter" runat="server" Visible="true">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="padding:5px;">
<tr><td colspan="4" class="accordionHeader" style="border-style:none;padding-top:2px;padding-bottom:2px" ><asp:Label CssClass=".grid .headerstyle" runat="server" ID="Label1">Filtre de sélection </asp:Label></td></tr>
<tr class="accordionContent" style="padding-bottom:5px;">
<td class="popupcell02" align="left" width="200px" style="HEIGHT: 16px">Employé :</td>
<td width="200px" style="HEIGHT: 16px">
<asp:DropDownList ID="ddlEmployes" runat="server" Width="100%" AutoPostBack="True"
DataValueField ="NoEmploye" DataTextField ="FullName"
DataSourceID="odsListEmployeesActif" ></asp:DropDownList></td>
<td class="popupcell02" align="left" style="padding-left:5px;" >
<asp:Label ID="lblTitre" runat="server" CssClass="popupcell02"></asp:Label>
</td>
<td align ="right" >
Plan de formation version imprimable.
<asp:HyperLink ID="hylSuiviPlan" runat="server" ImageUrl ="/Apps/Images/Boutons/outils/imprimer.gif" Target ="_blank" />
</td>
</tr>
<tr class="accordionContent" style="padding-bottom:5px;">
<td class="popupcell02" align="left" >Type de document :</td>
<td >
<asp:dropdownlist id="ddlTypeDocument" runat="server" CssClass="textbox" Width="100%" AutoPostBack="true">
<asp:ListItem Text ="-" Value =""></asp:ListItem>
<asp:ListItem Text ="Procédure" Value ="PROCÉDURE"></asp:ListItem>
<asp:ListItem Text ="Instruction" Value ="INSTRUCTION-JDE"></asp:ListItem>
</asp:dropdownlist>
</td>
<td colspan="2" align="right">
Attestation de formation en attente d'une approbation.
<asp:HyperLink ID="hEnApprobation" runat="server"
ImageUrl ="/Apps/Images/Boutons/outils/imprimer.gif" Target ="_blank" />
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
<tr height="10px" ><td></td></tr>
<tr>
<td colspan ="2">
<asp:Panel runat="server" ID="pnlContainer" ScrollBars="Auto" Height="310px">
<asp:GridView ID="dgFormation" runat="server" DataSourceID="odsListFormation" DataKeyNames="ID,DateMiseVigueurDoc"
AutoGenerateColumns="False" Width="98%" AllowSorting="True" ShowHeader="true">
<HeaderStyle CssClass="headerFixestyle" />
<Columns>
<asp:TemplateField HeaderText="Code" SortExpression ="Code" >
<ItemTemplate >
<asp:LinkButton ID="lkbDocument" runat ="server" Text ='<%# Eval("Code") %>' Visible ='<%# GetNombreDocument(Container.DataItem) = 2 %>' onclick="lkbDocument_Click" CommandName ="Select" ></asp:LinkButton>
<asp:HyperLink ID="hypDocument2" runat="server" Text='<%# Eval("Code") %>' Enabled = '<%# GetNombreDocument(Container.DataItem) > 0 %>' Visible ='<%# GetNombreDocument(Container.DataItem) <> 2 %>' NavigateUrl='<%# GetDocumentUrl(Container.DataItem) %>' Target ="_blank"></asp:HyperLink>
<asp:HiddenField ID="hdfCheminFichierFr" runat ="server" Value ='<%# Eval("CheminFichierFr") %>' />
<asp:HiddenField ID="hdfCheminFichierEn" runat ="server" Value ='<%# Eval("CheminFichierEn") %>' />
</ItemTemplate>
<ItemStyle CssClass="texte" Width="10%" />
<ControlStyle CssClass="texte" />
</asp:TemplateField>
<asp:BoundField DataField="Titre" SortExpression="Titre" HeaderText="Titre" HtmlEncode ="false" >
<ItemStyle CssClass="texte" Width="55%"/>
</asp:BoundField>
<asp:TemplateField HeaderText ="Lecture" SortExpression="Theorique" >
<ItemTemplate >
<center>
<asp:Image ID="imgTheorique" runat="server" ImageUrl="/Apps/images/Puces/Dark_check.gif" Visible ='<%# Eval("Theorique") %>' />
</center>
</ItemTemplate>
<ItemStyle CssClass="texte" Width="7%" />
</asp:TemplateField>
<asp:TemplateField HeaderText ="Pratique" SortExpression="Pratique">
<ItemTemplate >
<center>
<asp:Image ID="Image1" runat="server" ImageUrl="/Apps/images/Puces/Dark_check.gif" Visible ='<%# Eval("Pratique") %>' />
</center>
</ItemTemplate>
<ItemStyle CssClass="texte" Width="7%" />
</asp:TemplateField>
<asp:TemplateField HeaderText ="Statut" >
<ItemTemplate >
<center >
<asp:Image ID="imgStatus" runat="server" ImageUrl='<%# Eval("Statut","../Images/IconSystem/Indicateur/{0}.gif") %>' ToolTip ='<%# ToolTip(Container.DataItem) %>'/>
</center>
</ItemTemplate>
<ItemStyle CssClass="texte" Width="5%" />
</asp:TemplateField>
<asp:TemplateField HeaderText ="Formulaire" >
<ItemTemplate >
<center >
<asp:Button ID="btnComplete" runat ="server" Text ="F-316"
CommandArgument ='<%# Eval("Code") %>' CommandName ="Select"
CssClass="button" Enabled='<%# not Eval("Statut").equals("green") %>'/>
</center>
</ItemTemplate>
<ItemStyle CssClass="texte" Width="6%"/>
<ControlStyle CssClass="texte" />
</asp:TemplateField>
</Columns>
<EmptyDataTemplate >
Aucune donnée pour cette sélection
</EmptyDataTemplate>
</asp:GridView>
</asp:Panel>
</td>
</tr>
<tr><td></td><td align="right" style="height:25px" valign="bottom">
<asp:Label ID="lbTotal" runat="server" Font-Bold="True"></asp:Label>
</td></tr>
</table>
<asp:ImageButton ID="btnTarget1" runat="server" Visible ="true" Width ="0px" Height ="0px" />
<asp:ImageButton ID="btnTarget2" runat="server" Visible ="true" Width ="0px" Height ="0px" />
<asp:Panel ID="pnlFormation" runat ="server" Width ="25%" style="display:none;" >
<asp:FormView ID="formViewFormation" runat="server" CellPadding="0" style="width:100%" DataSourceID="odsFormation" DefaultMode ="Insert" >
<InsertItemTemplate>
<uc1:FormationForm ID="ctrInsertFormation" runat="server" Formateur='<%# Bind("Formateur") %>'
But='<%# Bind("But") %>' Type='<%# Bind("Type") %>' Titre='<%# Eval("Titre") %>' Commentaire='<%# Bind("Commentaire") %>' />
</InsertItemTemplate>
</asp:FormView>
</asp:Panel>
<cc1:ModalPopupExtender X="300" Y="100" ID="modalInsertPopup" runat="server" TargetControlID="btnTarget1"
PopupControlID="pnlFormation" BehaviorID="modalInsertPopup" BackgroundCssClass="modalBackground" >
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlSelection" runat ="server" Width ="40%" style="display:none;" SkinID="modal" >
<uc1:SelectionForm ID="ctrSelectionForm" runat ="server" CheminFichierFr ='<%# Eval("CheminFichierFr") %>' CheminFichierEn ='<%# Eval("CheminFichierEn") %>' />
</asp:Panel>
<cc1:ModalPopupExtender X="400" Y="100" ID="modalSelectionForm" runat="server" TargetControlID="btnTarget2"
PopupControlID="pnlSelection" BehaviorID="modalSelectionForm" BackgroundCssClass="modalBackground" >
</cc1:ModalPopupExtender>
<asp:ObjectDataSource ID="odsListFormation" runat="server"
SelectMethod="GetFormationsByEmploye"
TypeName="Ezem.BusinessObject.PlanFormationDB" >
<SelectParameters>
<asp:ControlParameter ControlID="ddlEmployes" Name="noEmploye" PropertyName="SelectedValue" Type="String" ConvertEmptyStringToNull ="false" />
<asp:ControlParameter ControlID="ddlTypeDocument" Name="type" PropertyName="SelectedValue" Type="String" ConvertEmptyStringToNull ="false"/>
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsListEmployeesActif" runat="server"
SelectMethod="GetListEmployeesActif"
TypeName="PersonnelDB">
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsFormation" runat="server"
InsertMethod="InscrireFormation"
TypeName="Ezem.BusinessObject.PlanFormationDB" >
<InsertParameters>
<asp:ControlParameter ControlID="dgFormation" Name="documentID" PropertyName="SelectedValue" Type="String" ConvertEmptyStringToNull ="false" />
<asp:Parameter Name="nature" Type="String" DefaultValue ="" ConvertEmptyStringToNull="false" />
<asp:Parameter Name="autre" Type="String" DefaultValue ="" ConvertEmptyStringToNull="false" />
<asp:Parameter Name="type" Type="String" ConvertEmptyStringToNull="false" />
<asp:Parameter Name="formateur" Type="String" ConvertEmptyStringToNull="false" />
<asp:Parameter Name="but" Type="String" ConvertEmptyStringToNull="false" />
<asp:Parameter Name="commentaire" Type="String" ConvertEmptyStringToNull="false" />
<asp:ControlParameter ControlID="ddlEmployes" Name="noEmploye" PropertyName="SelectedValue" Type="String" ConvertEmptyStringToNull ="false" />
<asp:Parameter Name="approbateur" Type="String" DefaultValue ="" ConvertEmptyStringToNull="false" />
<asp:Parameter Name="dateMiseVigueur" Type="DateTime" />
</InsertParameters>
</asp:ObjectDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
SuiviPlanFormation.aspx.vb
Imports System.Data
Imports Ezem.BusinessObject
Imports Utilitaires
Imports System.Collections.Generic
Imports System.Windows.Forms
Partial Class SuiviPlanFormation
Inherits System.Web.UI.Page
Public Const SORT_ASC As String = " <span style='font-family: Webdings;font-size:8px '> 5</span>"
Public Const SORT_DESC As String = " <span style='font-family: Webdings;font-size:8px '> 6</span>"
Protected WithEvents ctrInsertFormationForm As Controls_FormationForm
Protected WithEvents ctrInsertSelecForm As Controls_SelectionForm
Private showDocument As Boolean = False
Private approbateur As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ctrInsertFormationForm = formViewFormation.FindControl("ctrInsertFormation")
If (Not IsPostBack) Then
If (Utilitaires.IsInRole()) Then
ddlEmployes.Enabled = True
Else
ddlEmployes.Enabled = False
End If
End If
End Sub
Protected Sub odsListEmployeesActif_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) Handles odsListEmployeesActif.Selected
If (e.Exception IsNot Nothing) Then
lbMsgErreur.Text = e.Exception.Message
e.ExceptionHandled = True
End If
End Sub
Protected Sub odsDocuments_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) Handles odsFormation.Selected
If (e.Exception IsNot Nothing) Then
lbMsgErreur.Text = e.Exception.Message
e.ExceptionHandled = True
End If
End Sub
Protected Sub odsFormation_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles odsFormation.Inserting
If ctrInsertFormationForm.IsValide Then
If (e.InputParameters("type").ToUpper() <> "LECTURE") Then
Dim employe As New IEmploye(e.InputParameters("formateur"))
e.InputParameters("approbateur") = employe.NoEmploye
e.InputParameters("formateur") = employe.Fullname
approbateur = e.InputParameters("approbateur")
e.InputParameters("dateMiseVigueur") = CType(dgFormation.SelectedDataKey.Values(1), DateTime)
Else
e.InputParameters("dateMiseVigueur") = CType(dgFormation.SelectedDataKey.Values(1), DateTime)
e.InputParameters("approbateur") = String.Empty
e.InputParameters("formateur") = String.Empty
End If
Else
e.Cancel = True
lbMsgErreur.Text = "Erreur : Mauvais mot de passe!"
End If
End Sub
Protected Sub odsFormation_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) Handles odsFormation.Inserted
If (e.Exception IsNot Nothing) Then
If (e.Exception.InnerException IsNot Nothing) Then
lbMsgErreur.Text = e.Exception.InnerException.Message
End If
e.ExceptionHandled = True
Else
dgFormation.DataBind()
If (Not String.IsNullOrEmpty(approbateur)) Then
Try
Dim link As String = String.Format("{0}/Approbation.aspx", ConfigurationManager.AppSettings("LinkEnvironment"))
PersonnelDB.SendMailApprobation(approbateur, Session("NoEmploye"), ctrInsertFormationForm.Code & " - " & ctrInsertFormationForm.Titre, link)
Catch ex As Exception
End Try
dgFormation.SelectedIndex = -1
End If
End If
End Sub
Public Function ExistDocument(ByVal dataItem As Object) As Boolean
Return Not String.IsNullOrEmpty(GetDocumentUrl(dataItem))
End Function
Public Function GetNombreDocument(ByVal dataItem As Object) As Integer
Dim cheminFichierFr As String = String.Empty
Dim cheminFichierEn As String = String.Empty
If (Not DBNull.Value.Equals(DataBinder.Eval(dataItem, "CheminFichierFr"))) Then
cheminFichierFr = DataBinder.Eval(dataItem, "CheminFichierFr")
End If
If (Not DBNull.Value.Equals(DataBinder.Eval(dataItem, "CheminFichierEn"))) Then
cheminFichierEn = DataBinder.Eval(dataItem, "CheminFichierEn")
End If
If (Not String.IsNullOrEmpty(cheminFichierFr) And Not String.IsNullOrEmpty(cheminFichierEn)) Then
Return 2
ElseIf (Not String.IsNullOrEmpty(cheminFichierFr)) Then
Return 1
ElseIf (Not String.IsNullOrEmpty(cheminFichierEn)) Then
Return 1
End If
If (Not DBNull.Value.Equals(DataBinder.Eval(dataItem, "Type"))) Then
If (CType(DataBinder.Eval(dataItem, "Type"), String).Trim.ToUpper = "INSTRUCTION-JDE") Then
Return 1
End If
End If
Return 0
End Function
Public Function GetDocumentUrl(ByVal dataItem As Object) As String
Dim cheminFichierFr As String = String.Empty
Dim cheminFichierEn As String = String.Empty
If (Not DBNull.Value.Equals(DataBinder.Eval(dataItem, "CheminFichierFr"))) Then
cheminFichierFr = DataBinder.Eval(dataItem, "CheminFichierFr")
End If
If (Not DBNull.Value.Equals(DataBinder.Eval(dataItem, "CheminFichierEn"))) Then
cheminFichierEn = DataBinder.Eval(dataItem, "CheminFichierEn")
End If
If (Not String.IsNullOrEmpty(cheminFichierFr) And Not String.IsNullOrEmpty(cheminFichierEn)) Then
Return "javaScript:ShowPopUp('" & cheminFichierFr & "');"
ElseIf (Not String.IsNullOrEmpty(cheminFichierFr)) Then
Return cheminFichierFr
ElseIf (Not String.IsNullOrEmpty(cheminFichierEn)) Then
Return cheminFichierEn
End If
If (Not DBNull.Value.Equals(DataBinder.Eval(dataItem, "Type"))) Then
If (CType(DataBinder.Eval(dataItem, "Type"), String).Trim.ToUpper = "INSTRUCTION-JDE") Then
Return ConfigurationManager.AppSettings("PathUserGuide") & "=" & DataBinder.Eval(dataItem, "Code")
End If
End If
Return String.Empty
End Function
Protected Sub lkbDocument_Click(ByVal sender As Object, ByVal e As System.EventArgs)
showDocument = True
End Sub
Protected Sub dgFormation_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgFormation.SelectedIndexChanged
If (showDocument) Then
Dim hdfCheminFichierFr As HiddenField = dgFormation.SelectedRow.FindControl("hdfCheminFichierFr")
Dim hdfCheminFichierEn As HiddenField = dgFormation.SelectedRow.FindControl("hdfCheminFichierEn")
ctrSelectionForm.CheminFichierFr = hdfCheminFichierFr.Value
ctrSelectionForm.CheminFichierEn = hdfCheminFichierEn.Value
modalSelectionForm.Show()
showDocument = False
Else
If (ctrInsertFormationForm IsNot Nothing) Then
ctrInsertFormationForm.Reset()
End If
formViewFormation.ChangeMode(FormViewMode.Insert)
modalInsertPopup.Show()
ctrInsertFormationForm.DocumentID = dgFormation.SelectedDataKey.Value
End If
End Sub
Public Function ToolTip(ByVal dataItem As Object) As String
Dim result As String = String.Empty
Dim theorique As Object = DataBinder.Eval(dataItem, "TypeTheorique")
Dim pratique As Object = DataBinder.Eval(dataItem, "TypePratique")
Dim statut As String = CType(DataBinder.Eval(dataItem, "Statut"), String)
Dim invalides As New List(Of String)
If (Not DBNull.Value.Equals(theorique) AndAlso CType(theorique, Integer) = 1) Then
invalides.Add("Lecture")
End If
If (Not DBNull.Value.Equals(pratique) AndAlso CType(pratique, Integer) = 1) Then
invalides.Add("Pratique")
End If
If ("Yellow".Equals(statut)) Then
result = CType(DataBinder.Eval(dataItem, "Echeancier"), DateTime).ToString("MM/dd/yyyy")
ElseIf (invalides.Count = 0) Then
result = "Valide"
ElseIf (invalides.Count = 1) Then
result = "Invalide: " & invalides(0)
Else
result = "Invalides: " & String.Join(",", invalides.ToArray())
End If
Return result
End Function
Protected Sub dgridDocuments_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgFormation.DataBound
If (dgFormation.Rows.Count = 0) Then
lbTotal.Text = String.Empty
Else
lbTotal.Text = "Nombre de documents : " & dgFormation.Rows.Count
End If
End Sub
Protected Sub ddlEmployes_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlEmployes.SelectedIndexChanged
Dim emp As New IEmploye(ddlEmployes.SelectedValue)
lblTitre.Text = emp.PosteTXT
End Sub
Protected Sub ddlEmployes_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlEmployes.DataBound
ddlEmployes.SelectedValue = Session("NoEmploye")
Dim employe As New IEmploye(ddlEmployes.SelectedValue)
lblTitre.Text = employe.PosteTXT
End Sub
Protected Sub dgridDocuments_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles dgFormation.Sorting
Dim foundIndex As Short
Dim i As Integer
Dim sortDir As Long = -1
If Not IsNothing(ViewState("sortDir")) Then sortDir = ViewState("sortDir")
If Not String.IsNullOrEmpty(e.SortExpression) Then
For i = 0 To dgFormation.Columns.Count - 1
dgFormation.Columns(i).HeaderText = dgFormation.Columns(i).HeaderText.Replace(SORT_ASC, String.Empty)
dgFormation.Columns(i).HeaderText = dgFormation.Columns(i).HeaderText.Replace(SORT_DESC, String.Empty)
If dgFormation.Columns(i).SortExpression = e.SortExpression Then
foundIndex = i
End If
Next
If sortDir = SortDirection.Ascending Then
dgFormation.Columns(foundIndex).HeaderText &= HttpUtility.HtmlDecode(SORT_DESC)
ViewState("sortDir") = SortDirection.Descending
e.SortExpression &= " DESC"
ElseIf sortDir = SortDirection.Descending Then
dgFormation.Columns(foundIndex).HeaderText &= HttpUtility.HtmlDecode(SORT_ASC)
ViewState("sortDir") = SortDirection.Ascending
e.SortExpression &= " ASC"
Else
If (foundIndex = 0) Then
dgFormation.Columns(0).HeaderText &= HttpUtility.HtmlDecode(SORT_DESC)
ViewState("sortDir") = SortDirection.Descending
e.SortExpression &= " DESC"
Else
dgFormation.Columns(foundIndex).HeaderText &= HttpUtility.HtmlDecode(SORT_ASC)
ViewState("sortDir") = SortDirection.Ascending
e.SortExpression &= " ASC"
End If
End If
End If
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
If (Not IsPostBack) Then
hylSuiviPlan.NavigateUrl = "PrintReports.aspx?CodeReport=SuiviPlan&NoEmploye=" & Session("NoEmploye") & "&Type="
hEnApprobation.NavigateUrl = "PrintReports.aspx?CodeReport=EnApprobation&NoEmploye=" & Session("NoEmploye")
Else
hylSuiviPlan.NavigateUrl = "PrintReports.aspx?CodeReport=SuiviPlan&NoEmploye=" & ddlEmployes.SelectedValue & "&Type=" & ddlTypeDocument.SelectedValue
hEnApprobation.NavigateUrl = "PrintReports.aspx?CodeReport=EnApprobation&NoEmploye=" & ddlEmployes.SelectedValue
End If
End Sub
End Class
它在VB中使用Handles語句調用不是嗎?
受保護的子odsListEmployeesActif_Selected(ByVal sender As Object,ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) 處理odsListEmployeesActif.Selected
CommandName =“Select”按鈕是GridView命令的內置保留調用,還可以包含“更新”,“編輯”和“取消”
您的朋友看起來已創建自定義服務器控件來提供此功能。 圖表A:
<asp:Panel ID="pnlFormation" runat ="server" Width ="25%" style="display:none;" >
<asp:FormView ID="formViewFormation" runat="server" CellPadding="0" style="width:100%" DataSourceID="odsFormation" DefaultMode ="Insert" >
<InsertItemTemplate>
<uc1:FormationForm ID="ctrInsertFormation" runat="server" Formateur='<%# Bind("Formateur") %>'
But='<%# Bind("But") %>' Type='<%# Bind("Type") %>' Titre='<%# Eval("Titre") %>' Commentaire='<%# Bind("Commentaire") %>' />
</InsertItemTemplate>
</asp:FormView>
</asp:Panel>
<cc1:ModalPopupExtender X="300" Y="100" ID="modalInsertPopup" runat="server" TargetControlID="btnTarget1"
PopupControlID="pnlFormation" BehaviorID="modalInsertPopup" BackgroundCssClass="modalBackground" >
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlSelection" runat ="server" Width ="40%" style="display:none;" SkinID="modal" >
<uc1:SelectionForm ID="ctrSelectionForm" runat ="server" CheminFichierFr ='<%# Eval("CheminFichierFr") %>' CheminFichierEn ='<%# Eval("CheminFichierEn") %>' />
</asp:Panel>
<cc1:ModalPopupExtender X="400" Y="100" ID="modalSelectionForm" runat="server" TargetControlID="btnTarget2"
PopupControlID="pnlSelection" BehaviorID="modalSelectionForm" BackgroundCssClass="modalBackground" >
</cc1:ModalPopupExtender>
如果您無法正確識別此代碼段及其控件的標記前綴,則很可能是自定義控件。
不幸的是,這些自定義控件通常與Web項目分開開發,然后將編譯后的版本加載到項目中。 此外,服務器端控件生成的標記及其子例程,函數等都位於預編譯的代碼文件中。
這是我所有的書簽鏈接,其中包含有關自定義asp.net控件的信息。 祝好運!
我看到的唯一另一件事是代碼隱藏中的modalInsertPopup。 嘗試在此子中放置一個斷點,看看會發生什么。
Protected Sub dgFormation_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgFormation.SelectedIndexChanged
If (showDocument) Then
Dim hdfCheminFichierFr As HiddenField = dgFormation.SelectedRow.FindControl("hdfCheminFichierFr")
Dim hdfCheminFichierEn As HiddenField = dgFormation.SelectedRow.FindControl("hdfCheminFichierEn")
ctrSelectionForm.CheminFichierFr = hdfCheminFichierFr.Value
ctrSelectionForm.CheminFichierEn = hdfCheminFichierEn.Value
modalSelectionForm.Show()
showDocument = False
Else
If (ctrInsertFormationForm IsNot Nothing) Then
ctrInsertFormationForm.Reset()
End If
formViewFormation.ChangeMode(FormViewMode.Insert)
modalInsertPopup.Show()
ctrInsertFormationForm.DocumentID = dgFormation.SelectedDataKey.Value
End If
End Sub
我也想談談你的評論
代碼顯然是從Page_Load開始的。
這並非總是如此。 ASP.NET webforms頁面的生命周期中有幾個階段。 您可以查看ASP.NET頁面生命周期概述 - MSDN - Microsoft了解更多信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.