GridView acionou o evento RowEditing, que não foi tratado.
16/10/2013
0
Meu grid esta disparando o evento RowEditing mas eu não quero implementar ele. Estou implementando o RowComand, segue o meu codigo para avaliação
cs
<asp:GridView ID="grdDescicao" runat="server" AutoGenerateColumns="False" Width="100%" BackColor="White" AllowPaging="True" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" onrowcommand="grdDescicao_RowCommand" DataKeyNames="UGE,AnoBase,Sequencia,CNPJ/CPF" AllowSorting="True" onpageindexchanging="grdDescicao_PageIndexChanging" > <PagerSettings FirstPageText="Primeiro" LastPageText="Ultimo" Mode="NumericFirstLast" NextPageText="Proxímo" PreviousPageText="Anterior" /> <RowStyle BackColor="White" ForeColor="#003399" /> <Columns > <asp:BoundField DataField="Tipo Sancao" HeaderText="Tipo Sanção" ItemStyle-Width="110px"> <ItemStyle Width="110px"></ItemStyle> </asp:BoundField> <asp:BoundField DataField="Orgao" HeaderText="Orgão" /> <asp:BoundField DataField="Processo" HeaderText="Processo" /> <asp:BoundField DataField="Inicio" HeaderText="Início" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="false" ItemStyle-Width="50px"> <ItemStyle Width="50px"></ItemStyle> </asp:BoundField> <asp:BoundField DataField="Termino" HeaderText="Término" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="false" ItemStyle-Width="50px"> <ItemStyle Width="50px"></ItemStyle> </asp:BoundField> <asp:BoundField DataField="Poder" HeaderText="Poder" Visible="false"/> <asp:BoundField DataField="Codigo UGE" HeaderText="Codigo UGE" Visible="false"/> <asp:BoundField DataField="UGE" HeaderText="U.G.E." Visible="false"/> <asp:BoundField DataField="Codigo UGO" HeaderText="Codigo UGO" Visible="false"/> <asp:BoundField DataField="UGO" HeaderText="U.G.O." Visible="false"/> <asp:BoundField DataField="Fundamento Legal" HeaderText="Fundamento Legal" Visible="false"/> <asp:BoundField DataField="Prazo" HeaderText="Prazo" Visible="false"/> <asp:ButtonField CommandName="Edit" HeaderText="Link" Text="Visualizar"> <ItemStyle Width="10px" /> </asp:ButtonField> </Columns> <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" /> <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" /> </asp:GridView>
cs
protected void grdDescicao_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Contains("Edit")) { string UGE = grdDescicao.DataKeys[Convert.ToInt32(e.CommandArgument)]["UGE"].ToString(); string AnoBase = grdDescicao.DataKeys[Convert.ToInt32(e.CommandArgument)]["AnoBase"].ToString(); string Sequencia = grdDescicao.DataKeys[Convert.ToInt32(e.CommandArgument)]["Sequencia"].ToString(); string CNPJCPF = grdDescicao.DataKeys[Convert.ToInt32(e.CommandArgument)]["CNPJ/CPF"].ToString(); BS_ConsultaPublicaDescisao bs = new BS_ConsultaPublicaDescisao(); PreencherCampos(bs.CarregarDetalhes(UGE, AnoBase, Sequencia, CNPJCPF)); } } protected void grdDescicao_PageIndexChanging(object sender, GridViewPageEventArgs e) { grdDescicao.PageIndex = e.NewPageIndex; CarregarGridOutrasSancoes(); } private void CarregarGridOutrasSancoes() { string CNPJCPF = HttpContext.Current.Items["CNPJCPF"].ToString(); BS_ConsultaPublicaDescisao bs = new BS_ConsultaPublicaDescisao(); DataSet ds = bs.CarregarGrid(CNPJCPF, null, null, null); grdDescicao.DataSource = ds; grdDescicao.DataBind(); }
Rafael Miranda
Curtir tópico
+ 0
Responder
Posts
16/10/2013
Rafael Miranda
Esqueci de falar que objetivo que eu quero quando eu clico no link <asp:ButtonField CommandName="Edit" HeaderText="Link" Text="Visualizar"> é selecionar os dados da grid e preencher alguns labels que eu tenho na tela
Responder
16/10/2013
Rafael Miranda
conseguiram resolver o problema segue o link com a resposta [url]http://social.msdn.microsoft.com/Forums/pt-BR/0f084254-61af-4a55-a4fc-d608b56795c6/gridview-acionou-o-evento-rowediting-que-no-foi-tratado?forum=aspnetpt[/url]
Responder
Clique aqui para fazer login e interagir na Comunidade :)