checkbox value in gridview problem [asp.net 2005 with c#]

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2008
Posts: 36
Reputation: priyamsc is an unknown quantity at this point 
Solved Threads: 0
priyamsc priyamsc is offline Offline
Light Poster

checkbox value in gridview problem [asp.net 2005 with c#]

 
0
  #1
May 3rd, 2008
hi,
I have gridview in my application . in tat i have some fields as wel as 2 template colum which has linkbutton and check box. i have written coding in GridView1_RowCommand()
so it fires for link button properly but when i check the check box it wont fire..where as wheni check check box ten click the link button means its working i need separately the checkbox should fire and give the vale.what is the propery of checkbox to fire the row.

this is HTML codings
=============
  1.  
  2. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"ForeColor="#333333" GridLines="None" Width="780px" OnRowCommand="GridView1_RowCommand" ><FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
  3. <Columns>
  4. <asp:BoundField DataField="purno" HeaderText="PurchaseOrderNo" />
  5. <asp:BoundField DataField="purdate" HeaderText="PurchaseOderDate" />
  6. <asp:BoundField DataField="suppliername" HeaderText="SupplierName" />
  7. <asp:TemplateField HeaderText="View"><ItemTemplate>
  8. <asp:LinkButton ID="lnk_view" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"purno")%>' CommandName="show" Font-Bold="True">View</asp:LinkButton>
  9. </ItemTemplate></asp:TemplateField>
  10. <asp:TemplateField HeaderText="Approval">
  11. <ItemTemplate><asp:CheckBox ID="chk_app" runat="server" Font-Bold="True" Text="Approved" AutoPostBack="True" /> </ItemTemplate></asp:TemplateField></Columns> </asp:GridView>
  12. this is c# codings
  13. ===========
  14. protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  15. { if (e.CommandName == "show")
  16. { prno = e.CommandArgument.ToString();
  17. Response.Write(prno);
  18. GridView2.Visible = true;
  19. loadgridview2(); }
  20. foreach (GridViewRow gv in GridView1.Rows)
  21. { CheckBox chk = new CheckBox();
  22. chk = ((CheckBox)gv.Controls[0].FindControl("chk_app"));
  23. if (chk.Checked)
  24. { Response.Write("u have checked");
  25. } } }
Last edited by peter_budo; May 3rd, 2008 at 7:48 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 36
Reputation: priyamsc is an unknown quantity at this point 
Solved Threads: 0
priyamsc priyamsc is offline Offline
Light Poster

Re: checkbox value in gridview problem [asp.net 2005 with c#]

 
0
  #2
May 3rd, 2008
hi i got the msg when i checked the check box.i have written the coding in checkbox event [chk_app_CheckedChanged] but i need to know when i check the check box i need that row's first colum value ie., pno it is in first column in grid view so pls help me very urgent ..
thanking u
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC