hi all,
I have 3 autogenerated columns and 1 template column for checkbox and im using vs 2003 in asp.net
my code is -
Dim myDataGridItem As DataGridItem
-
Dim chkSelected As New System.Web.UI.WebControls.CheckBox
-
For Each myDataGridItem In dgresult.Items
-
chkSelected = myDataGridItem.FindControl("chkSelection")
-
If chkSelected.Checked Then
-
If dgresult.Items.Count Mod dgresult.PageSize = 1 And _
-
dgresult.CurrentPageIndex = dgresult.PageCount - 1 And _
-
dgresult.CurrentPageIndex <> 0 Then
-
dgresult.CurrentPageIndex = dgresult.CurrentPageIndex - 1
-
End If
-
'update command
-
End If
-
Next
-
chkSelected returns false and the command does not execute
6 1822
Which event are you using?
Which event are you using?
im using onclick event of update button
hi all,
I have 3 autogenerated columns and 1 template column for checkbox and im using vs 2003 in asp.net
my code is -
Dim myDataGridItem As DataGridItem
-
Dim chkSelected As New System.Web.UI.WebControls.CheckBox
-
For Each myDataGridItem In dgresult.Items
-
chkSelected = myDataGridItem.FindControl("chkSelection")
-
If chkSelected.Checked Then
-
If dgresult.Items.Count Mod dgresult.PageSize = 1 And _
-
dgresult.CurrentPageIndex = dgresult.PageCount - 1 And _
-
dgresult.CurrentPageIndex <> 0 Then
-
dgresult.CurrentPageIndex = dgresult.CurrentPageIndex - 1
-
End If
-
'update command
-
End If
-
Next
-
chkSelected returns false and the command does not execute
Hi
Check whether you have written ! Ispostback ! in the page load.
Because whenever you click a button, it postbacks and the checkbox you have selected became unchecked and hence it will return false
Please check this link
http://aspalliance.com/136_DataGrid_an d_Checkboxes
Hi
Check whether you have written ! Ispostback ! in the page load.
Because whenever you click a button, it postbacks and the checkbox you have selected became unchecked and hence it will return false
Please check this link
http://aspalliance.com/136_DataGrid_an d_Checkboxes
hi,
thankyou very...much hussain,
actually i have copied code from the same article
My doubt is after selecting the rows only i click the button then where to store the status of the checkbox and how to use those values
hi,
thankyou very...much hussain,
actually i have copied code from the same article
My doubt is after selecting the rows only i click the button then where to store the status of the checkbox and how to use those values
Hi Prabhu
If you click "Click here to download the ASPX page", it will open a new window with this link "http://authors.aspalli ance.com/das/dg_checkbox.htm l" :)
In this link there is a method name btnSelect_OnCli ck,
you have to declare a variable inside this method and if u have to insert those checked records then you have a write a insert query inside of the for loop :)
hi,
i found that the pageload event was called twice which lead to the uncheck of the datagrid checkbox
thank you all [:)]
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: RA |
last post by:
Hi
I wonder if anyone tried this or know if it has been fixed.
I am using vs .net 1.1 and have a windows form.
In the form I have a DataGrid with the following format:
3 first Columns are of type text box and 5 last columns are of type
checkbox(bool) I added some rows info.
When the RowHeadersVisible = false here is the problem I see:
When launching the application make sure to size down the window so that the
|
by: Just D |
last post by:
Hi All,
Does anybody know how to write the following code?
I have a database table with a few columns including: ID , "Task"
, ForceRun . I need to show the DataGrid on the ASPX page with
these selected fields and allow user to click one or more CheckBox controls
to activate this bit on the database table for a required ID.
I have already added a template column to the DataGrid and I can get the
|
by: Homa |
last post by:
Hi,
I have a Datagrid that uses as a shopping cart and have a checkbox
template column in it. I can't add both OnCheckedChanged Event and
onclick client script for it.
I want to do two things:
1. I want the checkbox fires CheckedChanged event. I did this as
|
by: Binny |
last post by:
I have a DG with autogenerated columns.
can i make a columns readonly like the data key column.
when edititemindex is valid.
Thanks
|
by: jax |
last post by:
Hi All developers !
I have a datagrid which autogenerates columns by the
sql SELECT list... The list (for some reasons) must be the
same. So my question is
HOW TO MOVE OUT A COLUMN
FROM AUTOGENERATED DATAGRID?
I would really appreciated answer with some code ! :))
| |
by: Luis Esteban Valencia |
last post by:
Once a user clicks "add new row", a new row is created in my Datagrid. The
datasource is huge so they have to scroll to the bottom of the page to edit
the data in the new row. I have come across two EE solutions which use
javascript to focus on the textbox in the "editcommandcolumn" mode.
However, these solutions were made for non-autogenerated columns. I NEED
autogenerated columns for my project.
Is it possible to give focus to a...
|
by: Nu2ASP.NET |
last post by:
What I am trying to do is essentially 'flip' the bits, when the user
clicks in the checkbox. For example, if the CheckBox appears checked,
and the user un-checks it, I want the underlying data field to change
from a "1" to a "0" (and vica versa).
I have the bindings worked out, I just can't figure out how to do the
update.
Here is my source:
|
by: Steve |
last post by:
How I can remove an AutoGenerated column? I wnat to inlcude the primary key
in the resultset for creating some custom LinkButtons, but I don't want it
(the PK) displayed in the DataGrid. I tried searching the columnheader text,
but found that AutoGenerated columns are members of the Columns collection.
From the msdn documentation:
Note: When the AutoGenerateColumns property is set to true, the columns
created by the DataGrid control are...
|
by: sheenaa |
last post by:
Hello Members,
I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005.
What i have used on forms :: ?
On my first form i have used some label,textboxs,dropdownlists,radiobutton and checkbox asp standard controls.
On the click event of the command button the data gets stored into the database.
I have created the stored procedures for the insert,update,delete.
I have...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |