我有下一个要求:显示多个选项的DropDownList 选择不同的客户,一旦我选择不同 客户端和clic按钮下拉列表中的网格 应该显示我选择的那些客户的报价,以及 如果我单击特定列,则应打开弹出窗口以显示详细信息 那个报价。
有不同的情况:
1.-如果我使用更新面板并在其中我放下拉列表和网格,当我在该特定列中弹出时弹出 不起作用。
2.-如果我不使用更新面板,一切都很好,除了 刷新网页。
3.-如果我在选择下拉列表中的内容之前加载网格数据,弹出窗口正在工作,直到我在下拉列表中选择某些内容,如果下拉列表触发的事件在某种程度上影响到网格或弹出窗口,这里的一切都在更新面板内。
¿你建议我什么?
我有下一个网页代码:
<div id="contentMain">
<asp:UpdatePanel ID="updPanel" runat="server">
<ContentTemplate>
<div style="margin-left: 190px; margin-bottom: -20px;">
<asp:LinkButton runat="server" ID="LinkButton1" title="Seleccionar Clientes" OnClientClick="refrescarGrid() return false;">
<span class="btnAceptar"></span>
</asp:LinkButton>
</div>
<table align="center">
<tr style="text-align: center">
<td class="labelTitle" style="background-color: #9AA8B3; border-radius: 3px;" colspan="1">
Seleccionar Clientes
</td>
</tr>
<tr>
<td style="font-size: 12px">
<cdis:ucDropDownListMultiple ID="ddlClients2" Requerido="false" LabelText="Clientes:"
runat="server" TextboxClassError="listaMultipleError chosen-choices" ContainerClass="ucTextbox"
TextboxClassNormal="chosen-choices" InputClassError="listaMultipleErrorInput"
InputClassNormal="chosen-choices" OpcionAgregar="false" ValidationGroup="vlg1"
Width="300px" MaxSelected="20" AutoPostBack="false" />
</td>
</tr>
</table>
<div style="">
<asp:LinkButton runat="server" ID="LinkButton2" title="Seleccionar Cotizaciones"
OnClick="btnGetSelectedQuotations">
<span class="btnAceptar"></span>
</asp:LinkButton>
</div>
<asp:ImageButton ID="btnSession" ImageUrl="" runat="server" OnClick="btnSession_Click"
Style="display: none;" />
<div class="subSection" align="center">
<table align="center">
<tr style="text-align: center">
<td class="labelTitle" style="background-color: #9AA8B3; border-radius: 3px;" colspan="1">
Cotizaciones Iniciales por Autorizar
</td>
</tr>
<tr>
<td>
<asp:ImageButton ID="ImageButton1" ImageUrl="" runat="server" OnClick="btnSession_Click"
Style="display: none;" />
</td>
</tr>
</table>
</div>
<div align="center">
<cc1:Grid ID="grdCatalogo" runat="server" AllowAddingRecords="false" Serialize="false"
ShowMultiPageGroupsInfo="false" AllowFiltering="false" AllowSorting="true" AllowGrouping="False"
AutoGenerateColumns="false" AllowPageSizeSelection="false" AllowColumnReordering="true"
AllowPaging="false" Width="100%" Height="100%" AllowRecordSelection="false" ShowFooter="false"
FolderLocalization="/Localization" Language="es" OnDataSourceNeeded="grdCatalogo_DataSourceNeeded">
<ExportingSettings ExportAllPages="true" ExportGroupHeader="true" ColumnsToExport="" />
<PagingSettings ShowRecordsCount="false" />
<ScrollingSettings NumberOfFixedColumns="0" FixedColumnsPosition="Left" />
<ClientSideEvents OnClientCallback="loadGridScripts" ExposeSender="true" />
<Columns>
<cc1:Column DataField="DeseasAutorizar" HeaderText=" Desea Autorizar" ItemStyle-Wrap="false"
Width="109px" Wrap="true" HeaderAlign="center" Align="center">
<TemplateSettings TemplateId="tplActionCheck" />
</cc1:Column>
<cc1:Column HeaderText="Código" DataField="tQuotationClientCode" Wrap="true" HeaderAlign="center"
Width="100px">
</cc1:Column>
<cc1:Column HeaderText="Nombre" DataField="tQuotationClientName" Wrap="true" HeaderAlign="center"
Width="248px">
</cc1:Column>
<cc1:Column HeaderText="Número de Cotización" DataField="tQuotationQuotationNumber"
Wrap="true" HeaderAlign="center" Width="120px">
<TemplateSettings TemplateId="tplIndividualQuotations" />
</cc1:Column>
<cc1:Column HeaderText="Número de Solicitud" DataField="tQuotationRequestNumber"
Wrap="true" HeaderAlign="center" Width="120px">
<TemplateSettings TemplateId="tplIndividualRequest" />
</cc1:Column>
<cc1:Column HeaderText="Tipo de Trabajo" DataField="tQuotationWorkType" Wrap="true"
Width="250px" HeaderAlign="center">
</cc1:Column>
<cc1:Column HeaderText="Código Producto del Cliente" DataField="tQuotationClientProductCode"
Wrap="true" Width="153px" HeaderAlign="center">
</cc1:Column>
<cc1:Column HeaderText="Nombre del Trabajo" DataField="tQuotationWorkName" Wrap="true"
Width="240px" HeaderAlign="center">
</cc1:Column>
<cc1:Column HeaderText="" DataField="tQuotationQuotationId" Visible="false">
</cc1:Column>
<cc1:Column HeaderText="" DataField="tQuotationRequestId" Visible="false">
</cc1:Column>
</Columns>
<Templates>
<cc1:GridTemplate runat="server" ID="tplActionCheck">
<Template>
<asp:CheckBox runat="server" ID="chkClientImp" EnableViewState="true" />
</Template>
</cc1:GridTemplate>
<cc1:GridTemplate runat="server" ID="tplIndividualRequest">
<Template>
<a class='modal' href='<%# "catIndividualRequest.aspx?pRequestId=" + 1+ "&pTmp=1"%>'
title="Actualizar Usuario">
<asp:Label ID="Label1" Text='<%#Container.DataItem["tQuotationRequestNumber"]%>'
runat="server" />
</a>
</Template>
</cc1:GridTemplate>
<cc1:GridTemplate runat="server" ID="tplIndividualQuotations">
<Template>
<a class='modal' href='<%# "catIndividualQuotation.aspx?pQuotationId=" + Container.DataItem["tQuotationQuotationId"] + "&pTmp=1"%>'
title="Actualizar Usuario">
<asp:Label ID="Label1" Text='<%#Container.DataItem["tQuotationQuotationNumber"]%>'
runat="server" />
</a>
</Template>
</cc1:GridTemplate>
</Templates>
</cc1:Grid>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
代码背后:
protected void grdCatalogo_DataSourceNeeded(object sender, GridDataSourceNeededEventArgs e)
{
int count = 0;
if (grdCatalogo.Rows != null)
{
foreach (GridRow row in grdCatalogo.Rows)
{
GridDataControlFieldCell cell = row.Cells[0] as GridDataControlFieldCell;
if (cell != null)
{
CheckBox asignar = cell.FindControl("chkClientImp") as CheckBox;
if (asignar.Checked)
{
DiccionarioAsignar.Add(count, asignar.Checked);
}
}
count++;
}
}
try
{
List<object> lst = new List<object>();
if (ddlClients2.GetSelectedItems().Count > 0)
{
foreach (System.Web.UI.WebControls.ListItem li in ddlClients2.Items)
{
if (li.Selected == true)
{
foreach (object obj in QuotationBLL.Get_QuotationInfoCatalogById(Convert.ToInt32(li.Value)))
{
lst.Add(obj);
}
}
}
}
grdCatalogo.DataSource = lst;
grdCatalogo.DataBind();
grdCatalogo.FolderStyle = "~/App_Themes/" + Page.Theme + "/styles/oboutgrid";
}
catch (CDISException ex)
{
MostrarErrorGeneral(ex.ErrorMessage);
ErrorOboutGrid = ex.ErrorMessage;
}
catch (Exception exGeneral)
{
MostrarErrorGeneral("Ocurrió un error inesperado. Verifique la información ingresada y contacte con el encargado de la aplicación.");
ErrorOboutGrid = "Ocurrió un error inesperado. Contacte con el encargado de la aplicación.";
}
}
答案 0 :(得分:2)
看起来您实际上是根据tplIndividualQuotations
通过JavaScript将“开放模式对话”代码挂钩到class="modal"
中的链接?
我相信你执行此操作的代码只在页面加载时触发一次(使用类似jQuery $()
方法或类似方法)。
问题是当重新加载UpdatePanel时,此代码不会再次运行,并且会将代码连接到已添加到页面的新<a>
元素上。
当你使用UpdatePanels时,你需要挂钩ASP.NET AJAX PageRequestManager
您需要向endRequest事件挂钩添加一个方法:
在异步回发完成并且控件已返回浏览器后引发。
所以你有类似的东西:
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(pageLoaded);
function pageLoaded(sender, args) {
//Code to hook up modal load here...
}
</script>