Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old December 12th, 2006, 12:09 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes i am not sure what event to use. If the gridview has say 7 rows and the user clicks the checkbox on row 3 only row 3 in DB should be updated.

www.nursery-net.com
Reply With Quote
  #12 (permalink)  
Old December 12th, 2006, 12:11 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If anyone has a working example of this i would be very greatful to see it working

www.nursery-net.com
Reply With Quote
  #13 (permalink)  
Old December 12th, 2006, 12:13 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

ok.. then we have to start again.. let's try to build the logic of what you are trying to achieve...

do you really want a postback in every checkbox click???
what if the user have to check several rows?


HTH

Gonzalo
Reply With Quote
  #14 (permalink)  
Old December 12th, 2006, 12:19 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no, i suppose that would be bad practise. I just cant seem to get my head around this

www.nursery-net.com
Reply With Quote
  #15 (permalink)  
Old December 12th, 2006, 12:21 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

ok.. so try the simple way...

put a button that commit the grid state (use the button click event) and loop the grid saving the checkbox state...

something similar to the code you have...

HTH

Gonzalo
Reply With Quote
  #16 (permalink)  
Old December 12th, 2006, 12:24 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes i had considered using the button but decided against it has the button would only be used to update the checkbox state in DB

www.nursery-net.com
Reply With Quote
  #17 (permalink)  
Old December 12th, 2006, 02:00 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

sorry i didn't understand you..
why not use the button???

HTH

Gonzalo
Reply With Quote
  #18 (permalink)  
Old December 13th, 2006, 04:00 AM
Authorized User
 
Join Date: Nov 2006
Location: Mandi, Himachal Pradesh, India.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to akhilhp
Default

How to find the checked property, Actually I am adding a checkbox to the gridview and getting the same problem as shown above. I tried to set the checked property true, but could not find this property there. the gridview source code is here:
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" Width="670px">
        <Columns>
            <asp:BoundField DataField="appno" HeaderText="Application Number" SortExpression="appno" />
            <asp:BoundField DataField="Applicant" HeaderText="Applicant" SortExpression="Applicant" />
            <asp:BoundField DataField="DateofApplication" HeaderText="Date of Application" SortExpression="DateofApplication" />
            <asp:BoundField DataField="TitleofCase" HeaderText="Title of Case" SortExpression="TitleofCase" />
            <asp:BoundField DataField="case_des" HeaderText="Case of Type" SortExpression="case_des" />
            <asp:BoundField DataField="nature_des" HeaderText="Nature of Case" SortExpression="nature_des" />
            <asp:CheckBoxField HeaderText="Submit?" />
        </Columns>
        <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
        <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
        <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
        <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
    </asp:GridView>
I am not binding this checkbox to any datafield. I only want that if the user wishes to submit he should check the check box field or otherwise uncheck it. And when a button the form is clicked the status will be updated in the database.
Reply With Quote
  #19 (permalink)  
Old December 13th, 2006, 05:07 AM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, i cant use a button because the checkbox is there to send a value (1 or 0) back to DB. Then on another form the gridview row will be displayed if a the DB value is 1. I dont want the users to get confused by say checking 3 boxes then having to click a button, also what if they choose to uncheck a box and have to press the button again. Also the button click wont be redirected to any other page, so i would rather do it on checkbox click

www.nursery-net.com
Reply With Quote
  #20 (permalink)  
Old December 13th, 2006, 05:29 AM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, maybe i havent explained it properly..
Basically, i want a gridview with a templatefield (or checkboxfield) with a checkbox on it that when the user clicks the checkbox it sends a 1 or 0 value back to DB (1 for checked and 0 for unchecked)



www.nursery-net.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView pady123 ASP.NET 2.0 Professional 0 November 13th, 2008 05:48 AM
Need your help about GridView khb3283 ASP.NET 2.0 Basics 1 November 9th, 2008 11:48 AM
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
How to Add CheckBoxField in ASP.NET creative.programmer ASP.NET 1.0 and 1.1 Basics 0 November 11th, 2007 05:47 PM
GridView simonwilbert ASP.NET 2.0 Basics 4 August 12th, 2006 02:40 AM



All times are GMT -4. The time now is 09:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.