I'm building a table using a asp:Repeater that is inside an UpdatePanel. A column of this table contains some buttons. When these buttons get pressed, there is a partial refresh (i think..) of the UpdatePanel.
What is strange is that some OTHER buttons that are outside and at the top of the table inside another UpdatePanel stop working.
They works perfectly if i don't click the buttons in the repeater. Otherwise they seem to not respond to click event anymore.
A clarification: The refresh button keep working. But even the simple checkbox does not work anymore.
Here is the code:
<div id="containerNotificationCenterDx">
<!-- Contains the five buttons that stop working -->
<div id="containerNotificationFilter">
<asp:UpdatePanel runat="server" ID="UpPnlBAction" UpdateMode="Conditional" ClientIDMode="static">
<ContentTemplate>
<div class="col11" style="padding-left: 10px">
<asp:CheckBox ID="cbSelectAllNotify" runat="server" CssClass="clickableRight" OnCheckedChanged="SelectAllNotify_CheckedChanged"
AutoPostBack="true" />
<asp:LinkButton runat="server" ID="IndexImgRefreshCM" OnClick="IndexImgRefreshCM_OnClick" CssClass="clickableRight">
<i class="fa fa-refresh"></i> <!-- this always works -->
</asp:LinkButton>
<asp:LinkButton runat="server" ID="IndexImgAddFilterCM" OnClientClick="return ajaxModalPopupAddFilterNotificationCenter();" CssClass="clickableRight">
<span id="spanAddFilter">
<i class="fa fa-filter"></i>
<i class="fa fa-plus"></i>
</span>
</asp:LinkButton>
<asp:LinkButton runat="server" ID="IndexImgRemoveFilterCM" OnClick="IndexImgRemoveFilter_OnClick" Enabled="false" CssClass="clickableRight">
<span id="spanRemoveFilter">
<i class="fa fa-filter"></i>
<i class="fa fa-minus"></i>
</span>
</asp:LinkButton>
<asp:LinkButton runat="server" ID="IndexImgExportCM" OnClientClick="return ajaxModalPopupExportDati();" CssClass="clickableRight">
<i class="fa fa-file-excel-o"></i>
</asp:LinkButton>
<asp:LinkButton runat="server" ID="IndexImgSmistaCM" OnClick="IndexImgSmista_OnClick" CssClass="clickableRight">
<span id="spanSmista">
<i class="fa fa-file-o"></i>
<i class="fa fa-arrow-right"></i>
</span>
</asp:LinkButton>
<asp:LinkButton runat="server" ID="IndexImgDeleteCM" OnClick="IndexImgRemove_OnClick" CssClass="clickableRight">
<i class="fa fa-trash-o"></i>
</asp:LinkButton>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<!-- Main notifications container -->
<div id="containerListNotify" style="padding-left: 5px;">
<asp:UpdatePanel ID="UpdatePanelRepListNotify" runat="server" UpdateMode="Conditional" ClientIDMode="Static">
<ContentTemplate>
<!-- DEFINISCE LA STRUTTURA DELLE NOTIFICHE -->
<asp:Repeater ID="repListNotify" runat="server" OnItemCommand="RepListNotify_ItemCommand"
OnItemDataBound="RepListNotify_ItemCreated">
<HeaderTemplate>
<table id="tableCentroMessaggi" class="table table-hover">
<thead>
<tr id="HeaderMessaggi">
<th>
<asp:Label runat="server" ID="docFascCol" Text='<%#this.getDocFascColText() %>' />
</th>
<th>
<asp:Label runat="server" ID="dataCol" Text='<%#this.getDataColText() %>' />
</th>
<th>
<asp:Label runat="server" ID="eventCol" Text='<%#this.getEventColText() %>' />
</th>
<th>
<asp:Label runat="server" ID="fromCol" Text='<%#this.getSenderColText() %>' />
</th>
<th>
<asp:Label runat="server" ID="objDescCol" Text='<%#this.getObjDescColText() %>' />
</th>
<th>
<asp:Label runat="server" ID="tipologyCol" Text='<%#this.getTipologyColText() %>' />
</th>
<th>
<asp:Label runat="server" ID="senderCol" Text='<%#this.getEmailColText() %>' />
</th>
<th>
<asp:Label runat="server" ID="noteCol" Text='<%#this.getNoteColText() %>' />
</th>
<th>
<asp:Label runat="server" ID="actionsCol" Text='<%#this.getActionsColText() %>' />
</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr id="messageRow" runat="server">
<td id="messageDetails">
<div>
<!-- checkbox rimozione notifica -->
<asp:CheckBox ID="IndexChkRemoveNotify" CssClass="clickableLeftN" runat="server" />
<!-- icona dettagli documento/fascicolo -->
<asp:LinkButton runat="server" ID="IndexImgDetailsDocument" CommandName="ViewDetailsDocument" CssClass="clickableRight">
</asp:LinkButton>
<!-- id -->
<br />
<div class="notifyField">
<span class="noLink">
<asp:LinkButton ID="lblNotifyLink" runat="server" Text='<%#this.getLabelFieldLink((NttDataWA.DocsPaWR.Notification) Container.DataItem) %>' CommandName="viewLinkObject" OnClientClick="disallowOpHome('Content2');">
</asp:LinkButton>
</span>
</div>
</div>
</td>
<td id="date">
<asp:Label ID="IndexLblDate" runat="server" Text='<%# Bind("DTA_EVENT") %>'></asp:Label>
</td>
<td id="mexEvent">
<asp:Label ID="Label2" runat="server" Text='<%# GetEvent((NttDataWA.DocsPaWR.Notification) Container.DataItem) %>'></asp:Label>
</td>
<td id="mexSender">
<asp:Label ID="Label3" runat="server" Text='<%# GetSource((NttDataWA.DocsPaWR.Notification) Container.DataItem) %>'></asp:Label>
</td>
<td id="objDescription">
<asp:Label ID="Label4" runat="server" Text='<%# GetObjDesc((NttDataWA.DocsPaWR.Notification) Container.DataItem) %>'></asp:Label>
</td>
<td id="tipology">
<asp:Label ID="Label5" runat="server" Text='<%# GetData((NttDataWA.DocsPaWR.Notification) Container.DataItem, Column.Tipology) %>'></asp:Label>
</td>
<td id="mittente">
<asp:Label ID="Label7" runat="server" Text='<%# GetData((NttDataWA.DocsPaWR.Notification) Container.DataItem, Column.Sender) %>'></asp:Label>
</td>
<td id="note">
<div id="containerNoteNotify" runat="server">
<div class="fieldNotesHome">
<div class="fieldNotesHomeBt">
<div class="weight">
<asp:Label ID="lblNotes" Text='<%$ localizeByText:IndexLblNotes%>' runat="server"
Visible="false"></asp:Label>
</div>
<div style="padding-top: 30px; padding-left: 55px;">
<cc1:CustomTextArea ID="txtNoteNotify" runat="server" TextMode="MultiLine" ClientIDMode="Static"
CssClass="homeNotes">
</cc1:CustomTextArea>
</div>
<div style="text-align: right;">
<asp:Button ID="litSaveNotes" Text='<%$ localizeByText:IndexLitSaveNotes%>' CommandName="SaveNotesNotify"
runat="server" CssClass="buttonNotes" ImageAlign="Right"></asp:Button>
<asp:Button ID="litRemoveNotes" Text='<%$ localizeByText:IndexLitRemoveNotes%>' CommandName="RemoveNotesNotify"
runat="server" CssClass="buttonNotes" ImageAlign="Right"></asp:Button>
</div>
</div>
</div>
</div>
</td>
<!-- these buttons generate the issue -->
<td id="actionsButtons">
<div id="actionsButtonsContainer">
<asp:LinkButton runat="server" ID="btnTypeDocCM" CommandName="ViewDocument" CssClass="clickableLeft"
ToolTip='<%$ localizeByText:IndexBtnTypeDocTooltip%>'>
<i class="fa fa-search"></i>
</asp:LinkButton>
<asp:LinkButton runat="server" ID="btnSignatureDetails" CommandName="SignatureDetails" CssClass="clickable"
ToolTip='<%$ localizeByText:DocumentSignatureDetails%>' Visible="false">
<i class="dettaglioFirma"></i>
</asp:LinkButton>
<asp:LinkButton runat="server" ID="IndexImgAdd" CommandName="AddNote" CssClass="clickableLeft"
Visible='<%#GetEnableNote() %>'>
<span class="fa-stack">
<i class="fa fa-file-o fa-stack-2x"></i>
<i class="fa fa-plus fa-stack-1x"></i>
</span>
</asp:LinkButton>
<asp:LinkButton runat="server" ID="IndexImgRemoveNotify" CommandName="RemoveNotify" CssClass="clickableRight">
<i class="fa fa-trash-o"></i>
</asp:LinkButton>
</div>
</td>
</tr>
<asp:HiddenField runat="server" ID="NotifyId" Value='<%# Bind("ID_NOTIFY") %>' />
</ItemTemplate>
<FooterTemplate>
</tbody>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:HiddenField ID="grid_rowindex" runat="server" ClientIDMode="Static" />
<asp:HiddenField ID="HiddenRemoveNotifications" runat="server" ClientIDMode="Static" />
<asp:HiddenField ID="HiddenRemoveNotification" runat="server" ClientIDMode="Static" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:HiddenField ID="grid_pageindex" runat="server" ClientIDMode="Static" />
<asp:UpdatePanel ID="upPnlGridIndexes" runat="server" ClientIDMode="Static" UpdateMode="Conditional">
<ContentTemplate>
<div id="navHome">
<asp:PlaceHolder ID="plcNavigator" runat="server" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
I don't get any error.
Update: All the controls in the "UpPnlBAction" UpdatePanel don't work.
Try to add in update panel ChildrenAsTriggers ="false" then see
https://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.childrenastriggers(v=vs.110).aspx
Check if this solves your problem or not
Related
I'm trying to fit a GridView (or a ListView, I've tried both) into the panel-body of a div panel. However, whenever the GridView appears, it closes out the panel-body early and causes formatting issues.
I've tried GridView, ListView, rearranging the elements of my panel, and I've trimmed a lot of stuff back to get it down to just the GridView.
<asp:ListView ID="lvOuter" runat="server" ItemPlaceholderID="placeHolder" DataKeyNames="PkUser" OnItemCommand="lvOuter_ItemCommand" OnSorting="lvOuter_Sorting" OnSelectedIndexChanging="lvOuter_SelectedIndexChanging" OnPagePropertiesChanging="lvOuter_PagePropertiesChanging">
<LayoutTemplate>
<table style="border-collapse: collapse; width: 100%">
<tbody>
<tr id="placeHolder" runat="server" style="width: 100%"></tr>
</tbody>
<tfoot>
<tr style="align-content: center;">
<td class="listViewFooterText" style="color: white; text-align: center">
<uc:listviewpager runat="server" id="ucOuterListViewPager" listviewcontrolid="lvOuter" />
</td>
</tr>
</tfoot>
</table>
</LayoutTemplate>
<ItemTemplate>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-user x1" style="text-align: left;" />
<b>
<asp:Label ID="lbEmployeeTitle" runat="server" Style="font-family: Arial; font-size: 14px;" Text='<%# Eval("EmployeeName") %>'></asp:Label></b>
<asp:Label ID="lbUnapprovedTitle" runat="server" CssClass="badge badge-blue" Text='<%# Eval("TotUnapproved") %>'></asp:Label>
</h3>
</div>
<div class="panel-body">
<asp:GridView ID="gvInner" runat="server" DataSource='<%# Eval("IndividualTracking") %>' AutoGenerateColumns="false" DataKeyNames="PkTrainingRequest" OnRowCommand="gvInner_RowCommand">
<Columns>
<asp:TemplateField ItemStyle-Width="40%" HeaderText="Title">
<ItemTemplate>
<asp:LinkButton ID="kbTitle" runat="server" CssClass="gridViewRowText" CommandName="Populate" ToolTip="Go to Training Request" Text='<%# Eval("Title") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="20%" HeaderText="Length">
<ItemTemplate>
<asp:LinkButton ID="kbLength" runat="server" CssClass="gridViewRowText" CommandName="Populate" ToolTip="Go to Training Request" Text='<%#Eval("Length") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="30%" HeaderText="Date">
<ItemTemplate>
<asp:LinkButton ID="kbDate" runat="server" CssClass="gridViewRowText" CommandName="Populate" ToolTip="Go to Training Request" Text='<%#Eval("Date") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="10%" HeaderText="Approve">
<ItemTemplate>
<asp:Button ID="btnQuickApprove" runat="server" Text="Quick Approve" CssClass="btn btn-success" CommandName="Approve" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<div class="panel-footer">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-2">
<asp:Button ID="btnDrillDown" Text='<%#Eval("Subordinates") %>' CommandName="DrillDown" CssClass="btn btn-primary" runat="server" Visible='<%#Eval("VisibleSubordinates") %>' />
</div>
<div class="col-md-2">
</div>
<div class="col-md-2">
<asp:Button ID="btnViewTraining" Text="View All Training" CommandName="ViewTraining" CssClass="btn btn-primary" runat="server" />
</div>
<div class="col-md-4"></div>
</div>
</div>
</div>
</ItemTemplate>
</asp:ListView>
Expected result: panels, each with a header and footer, and a gridview (when it populates) in the body.
Actual result: the panels work fine until the gridview populates. When that happens, the panel-body ends before the gridview, and the panel-footer attaches to the top of the next panel.
You made a tr the placeHolder. So it generates this, which is incorrect html
<table style="border-collapse: collapse; width: 100%">
<tbody>
<div class="panel panel-default">
xxx
</div>
So if you want to use a correct table, make the LayoutTemplate like this
<asp:ListView ID="lvOuter" runat="server" ItemPlaceholderID="placeHolder">
<LayoutTemplate>
<table style="border-collapse: collapse; width: 100%">
<tbody>
<tr>
<td>
<span id="placeHolder" runat="server"></span>
</td>
</tr>
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<div class="panel panel-default">
</div>
</ItemTemplate>
</asp:ListView>
Which generates
<table>
<tbody>
<tr>
<td>
<div class="panel panel-default">
</div>
<div class="panel panel-default">
</div>
</td>
</tr>
</tbody>
</table>
This still places everything in a single table cell. If you want a cell per ItemTemplate you need to put <tr><td> in it.
List view code:
<section id="service" class="bg-light paddingtop-60">
<div class="container">
<div class="row col-md-12">
<div class="col-md-3">
<asp:SqlDataSource ID="DoctorSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:eSoft_DHD_BusinessConnectionString %>"
SelectCommand="SELECT DoctorChambers.City, DoctorMains.DoctorName, DoctorMains.Title, DoctorMains.ProfileImage, DoctorMains.DoctorID FROM DoctorChambers RIGHT OUTER JOIN DoctorMains
ON DoctorChambers.DoctorMain_DoctorID = DoctorMains.DoctorID WHERE (DoctorChambers.City LIKE '%' + #City + '%') AND (DoctorMains.DoctorName LIKE '%' + #DoctorName + '%')">
<SelectParameters>
<asp:SessionParameter Name="City" SessionField="DocCity" Type="String"/>
<asp:SessionParameter Name="DoctorName" SessionField="DocSession" Type="String"/>
</SelectParameters>
</asp:SqlDataSource>
<div class="col-md-9">
<asp:ListView ID="DoctorListView" runat="server" DataSourceID="DoctorSqlDataSource">
<ItemTemplate>
<table class ="table table-bordered">
<tr class="bg-gray">
<td class ="col-md-2">
<asp:Image ID="ProfileImage" runat="server" Width="120" Height="120" CssClass="person img-circle" ImageUrl='<%# "PublicPages/Search.aspx?ImageID="+Eval("DoctorId") %>' />
<%--<asp:Image ID="ProfileImage" runat="server" Width="120" Height="120" CssClass="person img-circle" ImageUrl=' ~/PublicPages/Search.aspx?ImageID=<%#Eval("DoctorId") %>' />--%>
</td>
<td class="col-md-4">
<asp:Label ID="DoctorNameLabel" runat="server" Text='<%# Eval("DoctorName") %>' />
</td>
<td class="col-md-6">
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
</td>
<td class="col-md-8">
<asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' />
</td>
</tr>
</table>
</ItemTemplate>
<AlternatingItemTemplate>
<table class ="table table-bordered">
<tr style="">
<td class ="col-md-2">
<asp:Image ID="ProfileImage" runat="server" Width="120" Height="120" CssClass="person img-circle" ImageUrl='<%# "PublicPages/Search.aspx?ImageID="+Eval("DoctorId") %>' />
<%-- <asp:Image ID="ProfileImage" runat="server" Width="120" Height="120" CssClass="person img-circle" ImageUrl=' ~/PublicPages/Search.aspx?ImageID=<%#Eval("DoctorId") %>' />--%>
</td>
<td class="col-md-4">
<asp:Label ID="DoctorNameLabel" runat="server" Text='<%# Eval("DoctorName") %>' />
</td>
<td class="col-md-6">
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
</td>
<td class="col-md-8">
<asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' />
</td>
</tr>
</table>
</AlternatingItemTemplate>
<EmptyDataTemplate>
<table runat="server" style="">
<tr>
<td>No data was returned.</td>
</tr>
</table>
</EmptyDataTemplate>
</asp:ListView>
</div>
</div>
</div>
</div>
</section>
This Problem was Solved . This problem was created for the missing of Data BindingSource and the Connection String.
I'm working on shopping cart application where I have listed all the products in a ListView. Then on button click of each product the image slider changes. Now I want to make it on mouseover instead of click. Below is the code I have tried to achieve.
ASP
<div class="col-md-12 ">
<div class="col-md-4 single_left pull-left">
<div class="flexslider">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Repeater runat="server" ID="Repeater">
<HeaderTemplate>
<ul class="slides">
</HeaderTemplate>
<ItemTemplate>
<li data-thumb='<%# "assets/products/"+DataBinder.Eval(Container.DataItem, "Image1") %>'>
<asp:Image ID="image5" runat="server"
ImageUrl='<%# "assets/products/"+DataBinder.Eval(Container.DataItem, "Image1") %>' />
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<script defer src="assets/js/jquery.flexslider.js"></script>
<link rel="stylesheet" href="assets/css/flexslider.css" type="text/css" media="screen" />
<!-- FlexSlider -->
<div class="caption">
<strong>
<asp:Label ID="lblPrice" runat="server" Text="*"></asp:Label></strong>
<strong>
<asp:Label ID="ItemCode" runat="server" Text="*"></asp:Label></strong>
<p>
<small><strong>
<asp:Label ID="lblDesc" runat="server" Text="*"></asp:Label>
</strong></small>
<br />
<asp:Label ID="lblID" Style="display: none;" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
<small>
<asp:Label ID="lblMsg" runat="server" Text="*" ForeColor="#990000"></asp:Label>
</small>
<br />
</p>
<asp:TextBox ID="txtqty" type="number" class="form-control" Text="0" runat="server"></asp:TextBox>
</div>
<asp:LinkButton ID="btnSubmit" type="submit" CssClass="add-cart item_add" runat="server" OnClick="btnSubmit_Click"><i class="fa fa-save"></i> Add to Cart</asp:LinkButton>
<script>
// Can also be used with $(document).ready()
$(window).load(function () {
$('.flexslider').flexslider({
animation: "slide",
controlNav: "thumbnails"
});
});
</script>
</div>
<div class="col-md-8 single-top-in simpleCart_shelfItem">
<asp:ListView ID="ImagesList" runat="server"
DataKeyNames="ID"
GroupItemCount="15"
OnPagePropertiesChanging="ImagesList_PagePropertiesChanging" OnSelectedIndexChanged="OnSelectedIndexChanged">
<EmptyDataTemplate>
No Images found.
</EmptyDataTemplate>
<LayoutTemplate>
<table>
<tr runat="server" id="groupPlaceholder" />
</table>
</LayoutTemplate>
<GroupTemplate>
<tr>
<td runat="server" id="itemPlaceholder" />
</tr>
</GroupTemplate>
<ItemTemplate>
<td>
<asp:LinkButton ID="LBtn" runat="server"
CommandName="Change"
OnCommand="btnDetails_Command"
CommandArgument='<%# Eval("Notes") %>'>
<img src='<%#"assets/products/"+Eval("ImageUrl").ToString() %>' class="image" style="Width:50px;Height:50px" alt="Change" onmouseover="this.OnCommand" />
</asp:LinkButton>
</td>
</ItemTemplate>
</asp:ListView>
</div>
<div class="clearfix"></div>
<!---->
</div>
I must say that your approach of mouseovering which triggers click - seems not as the right solution. ( Just saying)
Anyway - Change your code to :
<asp:LinkButton ... CssClass="myButton"
...
</asp:LinkButton>
Then , via jQuery (which you already use) :
$(function (){
$(".myButton").on('mouseover',function (){this.click()});
});
I have a listview control that is bounded by an entity query. The main listview is bounded to the entity called Article. The second listview(nested one) is bounded to an icollection of Article_Comment. I am trying to get the ID of a article so that I can use it in updating the article comment table. Below is what I have so far.
<asp:ListView ID="listComment" runat="server" DataKeyNames="ArticleID" >
<LayoutTemplate>
<div class="row">
<h3>Comments</h3>
<blockquote>
<asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
</blockquote>
</div>
</LayoutTemplate>
<ItemSeparatorTemplate>
<hr />
</ItemSeparatorTemplate>
<ItemTemplate>
<h4 class="text-error"><%#Eval("Title")%></h4>
<br />
<h4 class="text-error"><%#Eval("ArticleID")%></h4
<br />
<p><%#Eval("ArticleContent")%> </p>
<asp:ListView ID="list" runat="server" DataSource='<%# Eval("Article_CommentTable")%>'
InsertItemPosition="LastItem" OnItemCommand="list_ItemCommand" OnItemDataBound="list_ItemDataBound"
DataKeyNames="ArticleID" OnItemInserting="list_ItemInserting">
<LayoutTemplate>
<div class="row">
<h3>Comments</h3>
<asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
</div>
</LayoutTemplate>
<ItemTemplate>
<p>
Username : <%#Eval("UserName")%>
<br />
Comments : <%#Eval("Comment")%>
<br />
<%--<asp:Label ID="lblID" runat="server" Text='<%# Bind("ArticleID")%>'></asp:Label>--%>
<asp:HiddenField ID="hid" runat="server" Value='<%# Bind("ArticleID")%>' />
</p>
</ItemTemplate>
<InsertItemTemplate>
<div class="row" runat="server">
<asp:TextBox ID="txtUserName" runat="server" CssClass="form-control" />
<br />
<asp:TextBox ID="txtComment" runat="server" CssClass="form-control" />
<FCKeditorV2:FCKeditor ID="editorArticle" runat="server"
BasePath="~/FCKeditor/" Height="200px" Width="400px"
Value="Start typing here" ToolbarStartExpanded="False">
</FCKeditorV2:FCKeditor>
<br />
<asp:Button ID="btnAddComment" runat="server" CssClass="btn btn-info"
CommandName="insert" Text="Join The Discussion" CommandArgument='<%#Eval("ArticleID")%>' />
</div>
</InsertItemTemplate>
</asp:ListView>
</ItemTemplate>
</asp:ListView>
I am trying to access the ArticleID for each row that a button is clicked. How should I do that?
you can get it in ItemCommand event as listComment.DataKeys[dataItem.DisplayIndex].Value
I've been having this odd issue with modal popups. For some reason when I choose a dropdown item my update button wont fire a click event. but then I leave the dropdown at their default values the update button works just fine.
here's my aspx page code
<asp:Button ID="Button1" CssClass="hide" runat="server" Text="Button" />
<ajaxToolkit:ModalPopupExtender runat="server" ID="cfPopUp" PopupControlID="Panel4"
TargetControlID="Button1" OkControlID="cfUpdateBtn" CancelControlID="cfCancelBtn" />
<asp:Panel ID="Panel4" runat="server" CssClass="modalPopup">
<asp:UpdatePanel ID="UpdatePanel2" runat="Server">
<ContentTemplate>
<asp:Panel ID="Panel13" CssClass="" runat="server">
<asp:Panel ID="Panel14" CssClass="" runat="server">
<div style="padding: 10px; border: 3px solid black; background-color: White; color: Black;">
<asp:Label ID="Label25" Width="200px" runat="server" Text="Health and Safety Net" /><div
class="seperator">
</div>
<table class="style143">
<tr>
<td class="style185">
<asp:Label ID="cfCategorylbl" runat="server" Text="Category:"></asp:Label>:
</td>
<td>
<asp:DropDownList ID="cbFactors_Categories" runat="server" Width="350px" Font-Names="Tahoma"
Font-Size="Small" ForeColor="DimGray" Height="24px" CssClass="style75">
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="CascadingDropDown3" runat="server" TargetControlID="cbFactors_Categories"
Category="categories" ServiceMethod="getCategory" ServicePath="~/2012/IrSubmitWebService.asmx"
PromptText="Select Category" />
</td>
<td align="center" rowspan="3" valign="top">
<asp:Label ID="lblFactor_ID" runat="server" Font-Names="Tahoma" Font-Size="Small"
ForeColor="DimGray" Style="font-style: italic" TabIndex="56"></asp:Label>
<cc1:DynamicPopulateExtender ID="lblFactor_ID_DynamicPopulateExtender" runat="server"
Enabled="True" TargetControlID="lblFactor_ID" BehaviorID="dp1" ServiceMethod="getFactorID"
ServicePath="~/2012/IrSubmitWebService.asmx">
</cc1:DynamicPopulateExtender>
<hr class="style157" />
<asp:Label ID="cfID" runat="server" Font-Names="Tahoma" Font-Size="Small" ForeColor="DimGray"
Style="font-style: italic" Width="400px" TabIndex="57"></asp:Label>
</td>
</tr>
<tr>
<td class="style185">
<asp:Label ID="cfTypeslbl" runat="server" Text="Type:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="cbFactors_Types" runat="server" ForeColor="DimGray" Height="24px"
TabIndex="54" Width="350px" Font-Names="Tahoma" Font-Size="Small" CssClass="style75">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cbFactors_Types_CascadingDropDown" runat="server"
TargetControlID="cbFactors_Types" ParentControlID="cbFactors_Categories" Category="type"
ServiceMethod="getTypeofAction" ServicePath="~/2012/IrSubmitWebService.asmx"
PromptText="Select Type">
</cc1:CascadingDropDown>
</td>
</tr>
<tr>
<td class="style185">
<asp:Label ID="cfFactorslbl" runat="server" Text="Factor:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="cbFactors_Factors" runat="server" ForeColor="DimGray" Height="24px"
TabIndex="55" Width="350px" Font-Names="tahoma" Font-Size="Small" CssClass="style75">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cbFactors_Factors_CascadingDropDown" runat="server"
TargetControlID="cbFactors_Factors" ParentControlID="cbFactors_Types" Category="category"
ServiceMethod="getFactor" ServicePath="~/2012/IrSubmitWebService.asmx" PromptText="Select Factor">
</cc1:CascadingDropDown>
</td>
</tr>
<tr>
<td class="style185">
<asp:Label Text="Justification:" ID="cfJustificationlbl" runat="server"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="txtJustification" runat="server" ForeColor="DimGray" Height="29px"
Style="font-family: Tahoma; font-size: small" TabIndex="56" TextMode="MultiLine"
ToolTip="Provide a justification for this factor." Width="775px" Font-Names="Tahoma"
Font-Size="Small"></asp:TextBox>
</td>
</tr>
</table>
<br />
<div style="text-align: center">
<asp:Button CausesValidation="false" ID="cfUpdateBtn" runat="server"
Text="Update" CssClass="button" /><span style="margin-left: 10px"><asp:Button CausesValidation="false"
ID="cfCancelBtn" runat="server" Text="Cancel" CssClass="button" /></span></div>
</div>
</asp:Panel>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
and my code behind for my update (it just closes the popup)
Protected Sub cfUpdateBtn_Click(sender As Object, e As EventArgs) Handles cfUpdateBtn.Click
cfPopUp.Hide()
End Sub
For the life of me I can't figure out why the update button wont work when the dropdowns are not the default value.
Thanks for your help guys
The possible reason may be you are binding your dropdownlist with a webservice. Whenever you click to an item on dropdownlist webservice may be called. If webservice is called then may be your page again loaded ? I don't know the exact reason why it is not working. You have to check the service behavior what happened when the service is called.
I basically rebuilt my modal popup and update panel like so
<asp:Panel ID="pnlEditPopup" runat="server" CssClass="modalPopup">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Panel ID="pnlEditPopupContent" runat="server">
<div style="padding: 10px; border: 3px solid black; background-color: White; color: Black;">
<table cellpadding="0" cellspacing="4" border="0">
<tr>
<td class="name">Category:</td>
<td class="value">
<asp:DropDownList id="ddCat" runat="server">
<asp:listitem value="">No Selection</asp:listitem>
<asp:listitem value="Action">Action</asp:listitem>
<asp:listitem value="Worksite">Worksite</asp:listitem>
<asp:listitem value="Human Factors">Human Factors</asp:listitem>
<asp:listitem value="System Factors">System Factors</asp:listitem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="name">Type:</td>
<td class="value">
<asp:DropDownList id="ddType" runat="server" />
<ajaxToolkit:CascadingDropDown ID="ccType" runat="server"
TargetControlID="ddType"
ParentControlID="ddCat"
PromptText="No Selection"
LoadingText="Please Wait..."
ServicePath="~/2012/IrSubmitWebService.asmx"
ServiceMethod="getTypeofAction"
Category="Other"
/>
</td>
</tr>
<tr>
<td class="name">Factor:</td>
<td class="value">
<asp:DropDownList id="ddfactor" runat="server" />
<ajaxToolkit:CascadingDropDown ID="ccFactor" runat="server"
TargetControlID="ddfactor"
ParentControlID="ddType"
PromptText="No Selection"
LoadingText="Please Wait..."
ServicePath="~/2012/IrSubmitWebService.asmx"
ServiceMethod="getFactor"
Category="Other"
/>
</td>
</tr>
<tr>
<td>
Justification:
<asp:Label ID="factorID" runat="server" Visible="false"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtJustification" runat="server" ForeColor="DimGray" Height="100px"
Style="font-family: Tahoma; font-size: small" TabIndex="56" TextMode="MultiLine"
ToolTip="Provide a justification for this factor." Width="300px" Font-Names="Tahoma"
Font-Size="Small"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Factor ID<br />
and Description:
</td>
<td>
<asp:Label ID="factor_id_Desc" runat="server" Width="300px" Font-Names="Tahoma" Font-Size="Small"
ForeColor="DimGray" TabIndex="56"></asp:Label>
<cc1:DynamicPopulateExtender ID="DynamicPopulateExtender1" runat="server"
Enabled="True" TargetControlID="factor_id_Desc" BehaviorID="dp1" ServiceMethod="getFactorID"
ServicePath="~/2012/IrSubmitWebService.asmx">
</cc1:DynamicPopulateExtender>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="btnOkEditPopup" runat="server" Text="Ok" CssClass="button"/>
<span style="margin-left:10px"><asp:button id="btnCancelEditPopup" runat="server" text="Cancel" CssClass="button"/></span>
</td>
</tr>
</table>
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="mpeEdit" runat="server"
TargetControlID="btnOpenEditPopup"
PopupControlID="pnlEditPopup"
/>
Fixed my issue. I still dont know why it wasn't working when I asked the question but I was able to solve it. Thanks to all who looked into it for me.