Click here to Skip to main content
15,916,693 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: how to use code behind files function in aspx file Pin
Shaik Haneef8-Sep-08 0:18
Shaik Haneef8-Sep-08 0:18 
AnswerRe: how to use code behind files function in aspx file Pin
balaji.t8-Sep-08 0:32
balaji.t8-Sep-08 0:32 
QuestionEvent Handler for programmatically created LinkButton control help!! Pin
Rameez Raja7-Sep-08 19:50
Rameez Raja7-Sep-08 19:50 
AnswerRe: Event Handler for programmatically created LinkButton control help!! Pin
Sandeep Akhare7-Sep-08 22:38
Sandeep Akhare7-Sep-08 22:38 
GeneralRe: Event Handler for programmatically created LinkButton control help!! Pin
Rameez Raja8-Sep-08 0:34
Rameez Raja8-Sep-08 0:34 
GeneralRe: Event Handler for programmatically created LinkButton control help!! Pin
Sandeep Akhare8-Sep-08 0:53
Sandeep Akhare8-Sep-08 0:53 
QuestionWorking with ASP and ArcView Pin
buzzcore7-Sep-08 19:42
buzzcore7-Sep-08 19:42 
QuestionEvent Handler working for programmatically created LinkButton control help!! Pin
Rameez Raja7-Sep-08 19:38
Rameez Raja7-Sep-08 19:38 
Hello all,

I've been searching and googling for hours now and im getting nowhere, some advice would be greatly appreciated

i have added linkbutton control dynamically to table cells for each vehicle reservation startdatetime and enddatetime .and implemented its event handler as well . i have to display reservation details inside formview control
but when iam clicking on each linkbutton same record is displying inside formview on all linkbutton click .


can any body suggest me what i have to do for displaying related reservation record details inside formview on related linkbutton click .


Here is my code

MyDataAdapter = New Data.SqlClient.SqlDataAdapter("select * from tablename WHERE vehicleName like '" & Current_vehicles & "')", MyConnection)
            ds = New Data.DataSet()
            MyDataAdapter.Fill(ds, "tablename")
            Dim a As DateTime
            Dim b As DateTime
            Dim dt As Data.DataTable
            Dim dr As Data.DataRow
            dt = ds.Tables(0)
            For Each dr In dt.Rows
                
                a = (dr("StartDateTime").ToString())
                Dim timeSpanDiff1 As TimeSpan = a.Subtract(start_display_datetime) 
                Dim mins1 As Integer = timeSpanDiff1.Hours * 60 + timeSpanDiff1.Minutes  
                start_cell_number = mins1 / 15 

                b = (dr("EndDateTime").ToString())
                Dim timeSpanDiff2 As TimeSpan = b.Subtract(start_display_datetime) 
                Dim mins2 As Integer = timeSpanDiff2.Hours * 60 + timeSpanDiff2.Minutes   
                end_cell_number = mins2 / 15  

                For i = start_cell_number To end_cell_number 
                    testarray(i) = (dr("User_Name").ToString())
                Next
            Next

            Dim noOfTimes As Integer = 0
            Dim CurrentName As String = Nothing
           
            For d = 0 To 31
                Dim tbcell As TableCell = New TableCell()
                tbcell.Text = " "
               
                If testarray(d) = Nothing Then
                    'No booking case
                    CurrentName = Nothing
                    tbcell.BackColor = Color.FromName("#FFFFFF")
                Else

                    
                    CurrentName = testarray(d)
                    Dim lnkbutton As LinkButton = New LinkButton()
                    lnkbutton.ID = "lnkbutton" & CurrentName.ToString()
                    lnkbutton.Text = CurrentName.ToString()
                    lnkbutton.PostBackUrl = ""
                    lnkbutton.ToolTip = "Click here "
                    AddHandler lnkbutton.Click, AddressOf OnClickLink
                   
                    Dim j As Integer
                    
                    For j = d To 31
                        If testarray(j) = CurrentName Then
                            'same name repeated
                            noOfTimes = noOfTimes + 1

                        Else
                                                     
                            d = d + noOfTimes
                            Exit For
                        End If

                    Next

                    tbcell.Controls.Add(lnkbutton)
                    tbcell.BackColor = Color.FromName("#CCCCCC")
                    tbcell.ColumnSpan = noOfTimes
                    noOfTimes = 0
                End If

                trow.Cells.Add(tbcell)
            Next

            Table1.Rows.Add(trow)
        Next

Here is event handler code :

Protected Sub OnClickLink(ByVal sender As Object, ByVal e As EventArgs)
       FormView1.Visible = True
       Dim myConnection As New SqlConnection("Server=localhost;Database=Reservation;uid=sa;pwd=xxxxx")
       Dim ad As New SqlDataAdapter("SELECT * FROM name of table ", myConnection)
       Dim ds As New DataSet()
       ad.Fill(ds)
       FormView1.DataSource = ds
       FormView1.DataBind()

   End Sub





Any code suggestions or pointers to articles would be aprreciated.

Best Regards
Rameez
Questionhow to call code behind function in javascript ? [modified] Pin
$unil Dhiman7-Sep-08 19:35
$unil Dhiman7-Sep-08 19:35 
AnswerRe: how to call code behind function in javascript ? Pin
balaji.t8-Sep-08 0:49
balaji.t8-Sep-08 0:49 
AnswerRe: how to call code behind function in javascript ? Pin
hemant.kaushal8-Sep-08 2:39
hemant.kaushal8-Sep-08 2:39 
Questioni need a tab Pin
Nika Asgari7-Sep-08 18:57
Nika Asgari7-Sep-08 18:57 
AnswerRe: i need a tab Pin
Abhijit Jana7-Sep-08 19:47
professionalAbhijit Jana7-Sep-08 19:47 
AnswerRe: i need a tab Pin
Ravi Sant3-May-11 0:29
Ravi Sant3-May-11 0:29 
QuestionConvert a VB statement to C# Pin
reogeo20087-Sep-08 17:58
reogeo20087-Sep-08 17:58 
AnswerRe: Convert a VB statement to C# Pin
sumit70347-Sep-08 18:03
sumit70347-Sep-08 18:03 
GeneralRe: Convert a VB statement to C# Pin
N a v a n e e t h7-Sep-08 18:45
N a v a n e e t h7-Sep-08 18:45 
AnswerRe: Convert a VB statement to C# Pin
Guffa7-Sep-08 21:37
Guffa7-Sep-08 21:37 
GeneralRe: Convert a VB statement to C# Pin
N a v a n e e t h7-Sep-08 23:32
N a v a n e e t h7-Sep-08 23:32 
GeneralRe: Convert a VB statement to C# Pin
Guffa7-Sep-08 23:56
Guffa7-Sep-08 23:56 
GeneralRe: Convert a VB statement to C# Pin
Jay_se8-Sep-08 2:59
Jay_se8-Sep-08 2:59 
AnswerRe: Convert a VB statement to C# Pin
Blue_Boy7-Sep-08 20:48
Blue_Boy7-Sep-08 20:48 
GeneralRe: Convert a VB statement to C# Pin
N a v a n e e t h7-Sep-08 21:16
N a v a n e e t h7-Sep-08 21:16 
AnswerRe: Convert a VB statement to C# Pin
hemant.kaushal8-Sep-08 2:47
hemant.kaushal8-Sep-08 2:47 
AnswerRe: Convert a VB statement to C# Pin
Shaik Haneef8-Sep-08 3:44
Shaik Haneef8-Sep-08 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.