Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Protected Sub LinkButton_Click(sender As [Object], e As EventArgs)
Dim url As String = "TotalEffort.aspx?ID="&ID
Dim s As String = (Convert.ToString("window.open('") & url) + "', 'popup_window', 'width=300,height=100,left=100,top=100,resizable=yes');" ClientScript.RegisterStartupScript(Me.[GetType](), "script", s, True)
End Sub
I have above code for a pop up window to be displayed when clicked on a link button in grid view

The ID is to be taken from the first column of the respective row.And also when TotalEffort.aspx is opened I need to retrieve the ID passed in the url.

I wrote following code for retrieving the ID
If Not String. IsNullOrEmpty(Request. QueryString("ID").To String())Then
Dim ID As String
ID=Request. QueryString("ID").ToString()
Me.BindGrid(ID)
End If

And Following BindGrid method
Private Sub BindGrid(ByVal ID As String)
Dim objEffort As New Efforts
Dim dsEfforts As New DataSet
dsEfforts=ObjEffort.GetEffort(ID)
gvEfforts.DataSource=dsEfforts.Table(0)
gvEfforts.DataBind()
End Sub

Query in GetEffort(ID) is
Select Name, Effort from Effort where ID=@ID

I am getting object reference not set to an instant of object

Can someone help me out in displaying name and effort in popup window comparing the ID
Posted
Comments
[no name] 14-Sep-15 4:31am    
In which line you are getting object reference error?
Member 10279468 14-Sep-15 4:47am    
I debugged it and understood that ID value is not retrieved.
In BindGrid things went wrong but can't understand where and what. How to retrieve ID
[no name] 14-Sep-15 4:54am    
What is the value of ID you are getting? Because you calling BindGrid() when you have correct value(query string is not null).

Secondly ID is displaying in your browser URL and what is that value?

Make sure that you are passing ID when you opening popup. Please cross check.
Member 10279468 14-Sep-15 5:18am    
ID is displayed in the url.
I think the ID value is not passed in BindGrid.
How can I get that ID value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900