hi
i m using the datagrid for the displaying of the record i have done that thing dat the data gird will hid the delete button with the first record and display the delete button with the rows greater then 1 . now when i click the datgrid 2nd row that have edit button the page will refresh and the datagrid will display the same record with no delete button and then i have to click again the edit button that will edit the record
actually i want to edit the 2nd row record wih one click my code is shown below
Protected Sub dgorder_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgorder.ItemDataBound
Dim i As Integer
For i = 1 To ViewState("tot")
If e.Item.ItemIndex = 0 Then
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim btn As Button = CType(e.Item.Cells(10).FindControl("delBtn"), Button)
btn.Visible = False
End If
Else
If e.Item.ItemIndex = 1 Then
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim btn As Button = CType(e.Item.Cells(10).FindControl("delBtn"), Button)
btn.Visible = True
End If
End If
End If
Next
End Sub
for hiding the button i have subroutine
Function CanDelete() As Boolean
If ViewState("tot") > 1 Then
Return False
End If
End Function
hope i have explained well please help me
thanx in advance
4 1015
hi
i m using the datagrid for the displaying of the record i have done that thing dat the data gird will hid the delete button with the first record and display the delete button with the rows greater then 1 . now when i click the datgrid 2nd row that have edit button the page will refresh and the datagrid will display the same record with no delete button and then i have to click again the edit button that will edit the record
actually i want to edit the 2nd row record wih one click my code is shown below
Protected Sub dgorder_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgorder.ItemDataBound
Dim i As Integer
For i = 1 To ViewState("tot")
If e.Item.ItemIndex = 0 Then
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim btn As Button = CType(e.Item.Cells(10).FindControl("delBtn"), Button)
btn.Visible = False
End If
Else
If e.Item.ItemIndex = 1 Then
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim btn As Button = CType(e.Item.Cells(10).FindControl("delBtn"), Button)
btn.Visible = True
End If
End If
End If
Next
End Sub
for hiding the button i have subroutine
Function CanDelete() As Boolean
If ViewState("tot") > 1 Then
Return False
End If
End Function
hope i have explained well please help me
thanx in advance
Check Your Code at Page Load Data Fill Statement.
You should fill the data when not post back only.
Plz, check to be like that -
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
If Not IsPostBack Then
-
' datafill statement
-
End If
-
End Sub
-
hope this help,
<X>
Check Your Code at Page Load Data Fill Statement.
You should fill the data when not post back only.
Plz, check to be like that -
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
If Not IsPostBack Then
-
' datafill statement
-
End If
-
End Sub
-
hope this help,
<X>
at the page load event we can access e.item.itemindex tell me how to do thanx for ur reply
at the page load event we can access e.item.itemindex tell me how to do thanx for ur reply
plz see my sample code, remember to call data fill again -
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
If Not IsPostBack Then
-
DataLoad()
-
End If
-
End Sub
-
-
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
-
DataGrid1.EditItemIndex = e.Item.ItemIndex
-
DataLoad()
-
End Sub
-
-
Private Sub DataGrid1_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.CancelCommand
-
DataGrid1.EditItemIndex = -1
-
DataLoad()
-
End Sub
-
-
Private Sub DataLoad()
-
SqlDataAdapter1.Fill(DataSet11)
-
DataGrid1.DataBind()
-
End Sub
-
-
<X>
plz see my sample code, remember to call data fill again -
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
If Not IsPostBack Then
-
DataLoad()
-
End If
-
End Sub
-
-
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
-
DataGrid1.EditItemIndex = e.Item.ItemIndex
-
DataLoad()
-
End Sub
-
-
Private Sub DataGrid1_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.CancelCommand
-
DataGrid1.EditItemIndex = -1
-
DataLoad()
-
End Sub
-
-
Private Sub DataLoad()
-
SqlDataAdapter1.Fill(DataSet11)
-
DataGrid1.DataBind()
-
End Sub
-
-
<X>
i have already done that but does not work................................sorry
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tamir Khason |
last post by:
Follwing the struct:
public struct TpSomeMsgRep
{
public uint SomeId;
|
by: Tim::.. |
last post by:
Can someone please tell me why I keep getting the following error for some of
my web application users but not others??? Even though the application runs
from a central webserver???
Thanks for...
|
by: zeyais |
last post by:
Here is my HTML:
<style>
..leftcolumn{float:left;width:300px;border: 1px solid #ccc}
..rtcolumn{float:left;width:600px;border: 1px solid #ccc}
</style>
<body>
<div class="leftcolumn"...
|
by: Saps |
last post by:
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all...
|
by: N. Spiker |
last post by:
I am attempting to receive a single TCP packet with some text ending with
carriage return and line feed characters. When the text is send and the
packet has the urgent flag set, the text read from...
|
by: Rainer Queck |
last post by:
Hello NG,
I am currently confronted with the task to equip a vs2005 project with
context sensitive online help (F1).
Reading through the MSDN-Library I found out about the "HelpProvider" class,...
|
by: needhelp123 |
last post by:
Can any one send me a quick sort simple logic pogram...
its very urgent urgent
|
by: jenipriya |
last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors...
The table structures i hav
Employee (EmpID,...
|
by: psantosh12 |
last post by:
Hello Frnds
Please need help to resolve error.......... it is very very urgent........
The error is
Runtime Error
Description: An application error occurred on the server. The current custom...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |