473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help Me Pleazzzzzzzzzzzzeeeee its Urgent

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
Jan 22 '07 #1
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

Expand|Select|Wrap|Line Numbers
  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.      If Not IsPostBack Then
  3.            ' datafill statement
  4.      End If
  5. End Sub
  6.  
hope this help,

<X>
Jan 22 '07 #2
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

Expand|Select|Wrap|Line Numbers
  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.      If Not IsPostBack Then
  3.            ' datafill statement
  4.      End If
  5. End Sub
  6.  
hope this help,

<X>
at the page load event we can access e.item.itemindex tell me how to do thanx for ur reply
Jan 22 '07 #3
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
Expand|Select|Wrap|Line Numbers
  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.      If Not IsPostBack Then
  3.          DataLoad()
  4.      End If
  5. End Sub
  6.  
  7. Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
  8.      DataGrid1.EditItemIndex = e.Item.ItemIndex
  9.      DataLoad()
  10. End Sub
  11.  
  12. Private Sub DataGrid1_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.CancelCommand
  13.      DataGrid1.EditItemIndex = -1
  14.      DataLoad()
  15. End Sub
  16.  
  17. Private Sub DataLoad()
  18.     SqlDataAdapter1.Fill(DataSet11)
  19.     DataGrid1.DataBind()
  20. End Sub
  21.  
  22.  
<X>
Jan 22 '07 #4
plz see my sample code, remember to call data fill again
Expand|Select|Wrap|Line Numbers
  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.      If Not IsPostBack Then
  3.          DataLoad()
  4.      End If
  5. End Sub
  6.  
  7. Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
  8.      DataGrid1.EditItemIndex = e.Item.ItemIndex
  9.      DataLoad()
  10. End Sub
  11.  
  12. Private Sub DataGrid1_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.CancelCommand
  13.      DataGrid1.EditItemIndex = -1
  14.      DataLoad()
  15. End Sub
  16.  
  17. Private Sub DataLoad()
  18.     SqlDataAdapter1.Fill(DataSet11)
  19.     DataGrid1.DataBind()
  20. End Sub
  21.  
  22.  
<X>
i have already done that but does not work................................sorry
Jan 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
8
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...
7
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"...
17
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...
3
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...
7
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,...
9
needhelp123
by: needhelp123 | last post by:
Can any one send me a quick sort simple logic pogram... its very urgent urgent
6
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,...
1
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
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...
0
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...
0
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...
0
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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....
0
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
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.