| | |
checkbox value in gridview problem [asp.net 2005 with c#]
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 36
Reputation:
Solved Threads: 0
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
=============
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
=============
ASP Syntax (Toggle Plain Text)
<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" /> <Columns> <asp:BoundField DataField="purno" HeaderText="PurchaseOrderNo" /> <asp:BoundField DataField="purdate" HeaderText="PurchaseOderDate" /> <asp:BoundField DataField="suppliername" HeaderText="SupplierName" /> <asp:TemplateField HeaderText="View"><ItemTemplate> <asp:LinkButton ID="lnk_view" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"purno")%>' CommandName="show" Font-Bold="True">View</asp:LinkButton> </ItemTemplate></asp:TemplateField> <asp:TemplateField HeaderText="Approval"> <ItemTemplate><asp:CheckBox ID="chk_app" runat="server" Font-Bold="True" Text="Approved" AutoPostBack="True" /> </ItemTemplate></asp:TemplateField></Columns> </asp:GridView> this is c# codings =========== protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "show") { prno = e.CommandArgument.ToString(); Response.Write(prno); GridView2.Visible = true; loadgridview2(); } foreach (GridViewRow gv in GridView1.Rows) { CheckBox chk = new CheckBox(); chk = ((CheckBox)gv.Controls[0].FindControl("chk_app")); if (chk.Checked) { Response.Write("u have checked"); } } }
Last edited by peter_budo; May 3rd, 2008 at 7:48 pm. Reason: Keep It Organized - please use [code] tags
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: server content cannot be reset after http headers have been sent".
- Next Thread: Grid View Updating Errors Pls Help me...
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox class click commonfunctions compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dropdownlist dropdownmenu dynamic edit embeddingactivexcontrol expose findcontrol flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list login menu microsoft mono mssql multistepregistration nameisnotdeclared numerical objects order panelmasterpagebuttoncontrols problem ratings rotatepage save schoolproject search security serializesmo.table silverlight smartcard sql sqlserver2005 ssl suse textbox tracking unauthorized validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment webservice wizard xml youareanotmemberofthedebuggerusers





