rowcommand

GridView RowCommand Event is firing twice in UpdatePanel

只谈情不闲聊 提交于 2020-01-06 15:40:24
问题 I am facing a strange problem for last 2 days. My gridview's rowcommand event is firing twice when used inside the UpdatePanel. If I use it outside the update panel. It works as expected. Can anyone guide me how to solve this problem. My sample code is below : ASPX <asp:UpdatePanel ID="upDescription2" runat="server" UpdateMode="Conditional"> <Triggers> <asp:AsyncPostBackTrigge`enter code here`r ControlID="ddlDescription1" EventName="SelectedIndexChanged" /> </Triggers> <ContentTemplate> <asp

Retrieve data from visible false BoundField of Gridview

江枫思渺然 提交于 2019-12-22 05:36:20
问题 I have this BoundField in a GridView <asp:BoundField DataField="ReportId" HeaderText="RId" Visible="false" /> But when I try to get text in that field, it returns empty. protected void gvwReports_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ViewSchedule") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvwReports.Rows[index]; string s = row.Cells[0].Text; } } but, it returns a correct value if I change BoundField's .Visible property to true

Get DataKey values in GridView RowCommand

不想你离开。 提交于 2019-12-17 08:29:12
问题 I have a GridView with an associated DataKey , which is the item ID. How do I retrieve that value inside the RowCommand event? This seems to work, but I don't like the cast to LinkButton (what if some other command is firing the event?), and I'm not too confident about the NamingContainer bit. LinkButton lb = (LinkButton)e.CommandSource; GridViewRow gvr = (GridViewRow)lb.NamingContainer; int id = (int)grid.DataKeys[gvr.RowIndex].Value; I'm aware that I could instead pass that ID as the

OnRowCommand=“grd_RowCommand” event not firing when click on row

那年仲夏 提交于 2019-12-14 03:18:40
问题 here i bind grid columns dynamically using code behind because my GetSocailAnalytics method return dynamic column according to parameter passed.after binding column of grid using data table my grd_OnRowCommand event not firing when i click on grid row. grid is successfully bind. can any one help me out this issue.here is my code... <asp:GridView ID="grd" EnableViewState="true" AutoGenerateColumns="false" OnRowCommand="grd_RowCommand" runat="server" OnRowDataBound="grd_RowDataBound"> <Columns>

Gridview RowCommand event is fired when I do sorting in gridview

一个人想着一个人 提交于 2019-12-13 14:29:09
问题 I am trapped in some abnormal problem. When I do sorting in gridview, it fires RowCommand event for that grid instead of sorting event. Below is the HTML code for my grid view. <asp:GridView ID="grdDefects" runat="server" AutoGenerateColumns="False" OnPageIndexChanging="grdDefects_PageIndexChanging" OnSorting="grdDefects_Sorting" OnRowCommand="grdDefects_RowCommand" AllowSorting="true"> <PagerSettings Mode="NumericFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next"

Gridview RowCommand not working

夙愿已清 提交于 2019-12-13 04:07:56
问题 I am having problems trying to get a rowcommand event to fire in a gridview. I followed the code example from MSDNet but I cannot figure out why it is not working. The code is below. Thank you. <asp:GridView ID="GridViewProducts" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="5" CellSpacing="1" DataKeyNames="Pkey" DataSourceID="SqlDataSourceProducts" ForeColor="Black" GridLines="Vertical"> <FooterStyle

How to send multiple command arguments through command button ?(RowCommand Event)

浪子不回头ぞ 提交于 2019-12-12 12:01:21
问题 I'm Trying to send accross multiple command arguments when a rowcommand is called: <asp:TemplateField HeaderText="Status"> <ItemTemplate> <asp:Button ID="btnAct" runat="server" CausesValidation="False" CommandName="Action" Text='De-Activate' CommandArgument='<%# Bind("isActiveYN") + ";" + Bind("employeeid") %>' /> <asp:Label ID="lblActivate" runat="server" Text='<%# Bind("isActiveYN") %>' Visible='False'></asp:Label> </ItemTemplate> </asp:TemplateField> How ever when I use more than one

How to get GridView's LinkButton ForeColor in RowCommand Event?

一个人想着一个人 提交于 2019-12-11 23:59:35
问题 I have a GridView with the following columns. <Columns> <asp:TemplateField HeaderText="Item Description"> <ItemTemplate> <asp:Label ID="lblgvItemName" runat="server" Text='<%# Bind("ItemName") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="IssueQty" HeaderText="Issue Qty" /> <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="lnkReturn" runat="server" CommandName="Return" CommandArgument='<%# Eval("ItemName") + "," + Eval("IssueQty") + %>' Text="Return"

GridView Template - How to Grab Data from Selected Row

让人想犯罪 __ 提交于 2019-12-08 03:25:42
问题 <asp:TemplateField> <ItemTemplate> <table width="540" cellpadding="5"> <tr> <td align="left" style="width:60%;"> <img src='PurchaseHandler.ashx?ProductID=<%# Eval("ProductID")%>' alt="<%# Eval("ProductName") %>" /> </td> <td align="left"> <h3 style="text-align:left;"> <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("ProductName") %>' /> </h3> <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("Price") %>' /> <br /> <asp:LinkButton ID="cartLink" runat="server" Text="<b>Add to

Retrieve data from visible false BoundField of Gridview

ぐ巨炮叔叔 提交于 2019-12-05 07:57:04
I have this BoundField in a GridView <asp:BoundField DataField="ReportId" HeaderText="RId" Visible="false" /> But when I try to get text in that field, it returns empty. protected void gvwReports_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ViewSchedule") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvwReports.Rows[index]; string s = row.Cells[0].Text; } } but, it returns a correct value if I change BoundField's .Visible property to true COLD TOLD try somethink like this using client side html to hide <style type="text/css"> .hidden {