我有以下代码
protected void BubbleButton_Command(object sender, CommandEventArgs e)
{
if (e.CommandName == "Expand")
{
string strMonth = string.Empty;
string status = string.Empty;
string strCategory = "";
int idxCategory = 0;
if (e.CommandArgument != null)
{
string[] commandArgs = e.CommandArgument.ToString().Split(new string[] { "^" }, StringSplitOptions.None);
strCategory = commandArgs[0];
strMonth = commandArgs[1];
status = commandArgs[2];
hdnBubbleId.Value = "rptTimeLine_btn" + strMonth + status;
if (status == "B1")
{
status = "1";
}
else if (status == "B2")
{
status = "0";
}
else if (status == "B3")
{
status = "2";
}
}
DataTable dtDistinctCategoryValues = new DataTable();
Params = new Dictionary<string, object>();
Params["@status"] = Convert.ToInt32(status);
Params["@monthShortName"] = strMonth;
Params["@CategoryName"] = strCategory;
Params["@idx_Client"] = Convert.ToInt32(Session["Client_id"]);
string ProcName = "usp_getTaskDetailsByStatusCategoryAndMonth";
dtGetTaskdetails = new BusinessLogicCore().ExecuteDataTable(ProcName, Params, connection);
// to show the detailed view grid only bubble contain more than 1 task
if (dtGetTaskdetails.Rows.Count > 1)
{
/*Commented on 03/15/2016*/
DataView view = new DataView(dtGetTaskdetails);
dtDistinctCategoryValues = view.ToTable(true, "CategoryName");
RepeaterItem rptrow = ((sender as System.Web.UI.WebControls.Button).NamingContainer as RepeaterItem);
Repeater rptDetailsView = (Repeater)rptrow.FindControl("rptMarketingTimeLineDetiledView");
rptDetailsView.DataSource = dtDistinctCategoryValues;
rptDetailsView.DataBind();
ImageButton imgPlus = (ImageButton)rptrow.FindControl("imgPlus");
ImageButton imgMinus = (ImageButton)rptrow.FindControl("imgMinus");
hdnDetailsView.Value = "bubble";
hdnShowTaskDiv.Value = "0";
hdnMonthName.Value = "";
hdnIdx_task.Value = "";
hdnlnkTaskId.Value = "";
// Page.ClientScript.RegisterStartupScript(this.GetType(), "ExpandBubbleGrid", "ExpandDiv('" + imgPlus.ClientID + "', '" + imgMinus.ClientID + "');", true);
}
}
protected void rptMarketingTimeLineMonthDetiledView_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
GridView gridView = (GridView)e.Item.FindControl("GVMarketingTimeLineMonthlyDetiledView");
if (gridView != null)
{
DataRowView dataRowView = (DataRowView)e.Item.DataItem;
gridView.DataSource = GetPolicyDetailsByCategory(Convert.ToString(dataRowView["CategoryName"]));
gridView.DataBind();
}
}
}
上面给出的是代码背后的代码。
<asp:Button ID="btnDecB1" runat="server" rel="popover" data- toggle="popover" OnCommand="BubbleButton_Command" OnClientClick="return false;" CommandName="Expand" CommandArgument='<%#Eval("CategoryName")+"^Dec^B1"%>' Style="display: none;" onmouseover="dotBlink(this.id);" onmouseout="removedotBlink(this.id);" />
<div id="myPopover1" class="popover">
<div class="arrow"></div>
<div class="popover-content">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
<asp:Repeater ID="rptMarketingTimeLineDetiledView" runat="server" OnItemDataBound="rptMarketingTimeLineDetiledView_ItemDataBound">
<HeaderTemplate>
<table class="tblDetiledView">
</HeaderTemplate>
<ItemTemplate>
<tr style="margin-bottom: 10px; background-color: white;">
<td style="text-align: left;" nowrap="true">
<asp:Label ID="lblCategory" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"CategoryName") %>' CssClass="fontBold" Style="color: #23356E;"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="GVMarketingTimeLineDetiledView" runat="server" AutoGenerateColumns="false" GridLines="None" Style="width: 100%;" HeaderStyle-CssClass="MarketingTimeLineDetailedGridHeaderStyle" OnRowDataBound="RowDataBound" DataKeyNames="idx_task" ToolTip="Select a row to edit task details.">
<AlternatingRowStyle BackColor="#CDE5F5" />
<Columns>
<asp:BoundField DataField="TaskName" HeaderText="Task Name" ItemStyle-Width="20%" HeaderStyle-CssClass="MarketingTimeLineHeader" ItemStyle-CssClass="MarketingTimeLineitem" />
<asp:BoundField DataField="StartDate" HeaderText="Start Date" ItemStyle-Width="12%" HeaderStyle-CssClass="MarketingTimeLineHeader" DataFormatString="{0:MM/dd/yyyy}" ItemStyle-CssClass="MarketingTimeLineitem" />
<asp:BoundField DataField="ClientContacts" HeaderText="Client Contact" ItemStyle-Width="20%" HeaderStyle-CssClass="MarketingTimeLineHeader" ItemStyle-CssClass="MarketingTimeLineitem" />
<asp:BoundField DataField="StatusName" HeaderText="Status" ItemStyle-Width="15%" HeaderStyle-CssClass="MarketingTimeLineHeader" ItemStyle-CssClass="MarketingTimeLineitem" />
</Columns>
</asp:GridView>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</div>
以上是aspx代码 我的javascript代码是
$('[rel="popover"]').each(function () {
var $this = $(this);
$this.popover({
offset: 10,
trigger: 'click',
placement: 'right',
html: true,
content: $('#myPopover1').text(),
});
$('#mypopover').click(function () {
$(".popover").popover('hide');
});
});
当我点击按钮时,页面会刷新,如果我给OnClientClick="return false;"
,它将转到oncommand函数。如何在弹出窗口中获取转发器和网格视图的详细信息?