Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Teemu Keiski #1
Re: Template Column with button in header
Hi,
usually Button clicks inside DataGrid are managed by handling ItemCommand
event of the grid. Button is given a CommandName that is checked in
ItemCommand's event arguments (if there are multiple possibilities say
multiple buttons with different purposes). If you need more information,
please try describe your scenario more accurately.
--
Teemu Keiski
MCP,Designer/Developer
Mansoft tietotekniikka Oy
[url]http://www.mansoft.fi[/url]
ASP.NET Forums Moderator, [url]www.asp.net[/url]
AspAlliance Columnist, [url]www.aspalliance.com[/url]
Email:
[email]joteke@aspalliance.com[/email]
"IntraRELY" <IntraRELY@yahoo.com> kirjoitti viestissä
news:%23u$Sn0QQDHA.2424@tk2msftngp13.phx.gbl...I> Hello,
>
> I have a template column and in the header row I inserted a button. This
> button creates a loop through the dataset and if it finds a check box it
> opens a connection to the sql db and runs a delete stored procedure. Whenbutton> move this button outside the datagrid and just put it on the page it runs
> correctly. Is there something that needs to be done in order to use a> within a template column.
>
> TIA,
>
> Steve Wofford
> [url]www.IntraRELY.com[/url]
>
>
Teemu Keiski Guest
-
Header in a template column
Hi, I have a checkbox in the header of a template column in a datagrid. How can I check during runtime that whether checkbox is checked or not?I... -
Changing ImageURL of Image Button which is added in template column of datagrid
hello, I have a template column in my datagrid. To the header of template colum, i have added imagebutton. On click of the imagebutton , i... -
Image in header column (not replacing column header text)
I have a sortable (asc/desc) datagrid and would like to add a small arrow icon (down/up) next to the column header text to improve the UI. Is this... -
Bound Column or Template Column (w dAdapater?) in DataGrid
I am able to get the data using DataAdapter and the DataReader. I am more inclined to use DataAdapter because I want to update the data on the SQL... -
Button in column header
I want to put a button in a column header. How do I handle the event when the button is clicked? -
IntraRELY #2
Re: Template Column with button in header
It is a datagrid filled by a dataset. There are 6 columns and one template
column that is filled with checkboxes. In the header row of the checkbox
column there is a delete button which is used to delete all checked rows in
the datagrid. Here is the working code for when the botton is clicked.
Remember that when the button is used outside the datagrid this code works
correctly. However when the button is placed within the datagrid nothing
happens.
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDelete.Click
'Dim rowCount As Integer = 0
'Dim gridSelections As StringBuilder = New StringBuilder
Dim userIdItem As DataGridItem
'Open User Manager page's connection to SQL Database
SqlUserManager.Open()
cmdUsersDelete.CommandType = System.Data.CommandType.StoredProcedure
cmdUsersDelete.CommandText = "sp_usersdelete"
cmdUsersDelete.Connection = SqlUserManager
'Run through each row in the DataSet
For Each userIdItem In dgUserManager.Items
'Check to see if row is check
Dim myCheckbox As CheckBox = CType(userIdItem.Cells(6).Controls(1),
CheckBox)
'If checkbox is checked
If myCheckbox.Checked = True Then
'Set variable for userId" for delete
Dim selectedUserId
selectedUserId = dgUserManager.DataKeys(userIdItem.ItemIndex)
'Add variable as parameter to sp_usersdelete stored procedure
With cmdUsersDelete
..Parameters("@UserId").Value = selectedUserId
End With
Dim eNonQuery As Integer
Try
'Execute stored procedure
eNonQuery = cmdUsersDelete.ExecuteNonQuery
'Catch stored procedure's error message
Catch ex As System.Data.SqlClient.SqlException
lblMessage.Text = ex.Message
Finally
End Try
End If
Next
'Close database resources
SqlUserManager.Close()
daUserManager.Fill(DsUserManager)
dgUserManager.DataBind()
End Sub
Thanks for you input,
Steve Wofford
[url]www.IntraRELY.com[/url]
"Teemu Keiski" <joteke@aspalliance.com> wrote in message
news:eEOuowSQDHA.3880@tk2msftngp13.phx.gbl...When> Hi,
>
> usually Button clicks inside DataGrid are managed by handling ItemCommand
> event of the grid. Button is given a CommandName that is checked in
> ItemCommand's event arguments (if there are multiple possibilities say
> multiple buttons with different purposes). If you need more information,
> please try describe your scenario more accurately.
>
> --
> Teemu Keiski
> MCP,Designer/Developer
> Mansoft tietotekniikka Oy
> [url]http://www.mansoft.fi[/url]
>
> ASP.NET Forums Moderator, [url]www.asp.net[/url]
> AspAlliance Columnist, [url]www.aspalliance.com[/url]
>
> Email:
> [email]joteke@aspalliance.com[/email]
>
> "IntraRELY" <IntraRELY@yahoo.com> kirjoitti viestissä
> news:%23u$Sn0QQDHA.2424@tk2msftngp13.phx.gbl...> > Hello,
> >
> > I have a template column and in the header row I inserted a button. This
> > button creates a loop through the dataset and if it finds a check box it
> > opens a connection to the sql db and runs a delete stored procedure.runs> I> > move this button outside the datagrid and just put it on the page it> button> > correctly. Is there something that needs to be done in order to use a>> > within a template column.
> >
> > TIA,
> >
> > Steve Wofford
> > [url]www.IntraRELY.com[/url]
> >
> >
>
IntraRELY Guest



Reply With Quote

