Showing posts with label upon. Show all posts
Showing posts with label upon. Show all posts

Wednesday, March 28, 2012

The clicking twice hair pulling doesnt do anything problem!

I have a single page in which everything is loaded from user controls based upon a specific value in the URL. The user controls are dynamically loaded (only load the user controls I need based upon the key in the URL). Within the user control is a form with a single button. When I click the button, nothing happens. When I click it again it does a full postback but all user controls are gone and I haven't the slightest idea if it upated or not. Now the form is in an update panel so it shouldn't be doing a post back.

To reiterate:

1. single page (call it default.aspx)
2. click a link with the key in the url (kind of like "?k=1048")
3. default.aspx runs through a case statement and find the key value that matches the URL then loads the user control.
4. user control has form on it
5. click the submit button, nothing happens. Click it again and it does a postback and all user controls are gone (AJAX didn't work).

So, any ideas about having to click twice and also why the update panel doesn't seem to be working?

thanks

^_^

ps. if i put the user control in a completely separate page where it isn't dynamically loaded, things work as intended.

To start with, when using Dynamic Controls, you should already know that you should RECREATE your controls on every page request. Keeping this in mind, you should keep track of which UserControl was loaded before and then reload it again!

Hope this helps,
Regards


That's nice but didn't help at all nor directed me to even an idea

What I did find was that when I removed the triggers from the update panel then the double-clicking went away and it operated as intended. but I wonder what will happen when I have multiple controls on a page that each have an update panel and I update one, will it cause the others to fire as well even with the mode set to conditional.

Does anyone have an idea of this cause that knows what they are talking about.

thanks

Tuesday, March 13, 2012

The IListSource does not contain any data sources

After assigning a datasource to a grid, upon databind I get:

The IListSource does not contain any data sources

What in the world does that mean?IListSource is an interface that provides functionality to an object to return a list that can be bound to a datasource. A dataset for example implements this interface.

Did you databind your datagrid to a dataset obtained form a query to a database using ADO.NET ? Can you provide a snippet of code showing your commands to hook up the datasource and databind?
It was weird - I did the whole section again, code and controls and it worked. Thanks anyway!
I'm having this problem (The IListSource does not contain any data sources) and I don't know what could be wrong. If I test my SQL Query in SQL Analyzer, it does work fine. Now, when I run the query through my ASP.NET page, it sometimes work and others not, even though is the same query.

Dim connectionString As String = "Server='ServerName';User ID=username; Password=mypassword;database='databasename'"

Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

'Set max num of rows
Dim strSQLMaxRecords as string
If intMaxRecords > 0 Then
strSQLMaxRecords = " TOP " & CStr(intMaxRecords) & " "
Else
strSQLMaxRecords = ""
End If

Dim queryString As String = _
"SELECT " & strSQLMaxRecords & _
" * " & _
" FROM dwidx.dbo.fsc_followup as TFUP" & _
" ,dwidx.dbo.patient_fsc_list as TPFL " & _
" ,dwidx.dbo.patient as TPAT " & _
" WHERE " & _
" (TPFL.id = TFUP.id)" & _
" AND (TFUP.id = TPAT.id)" & _
" AND (TPFL.fsc = TFUP.fsc)" & _
" AND (TPAT.oth_num IS NOT NULL)" & _
" AND (TPAT.del_dt IS NULL)" & _
" AND (TPAT.deact_dt IS NULL)" & _
" AND (TPAT.deceased_indicator IS NULL " & _
" OR TPAT.deceased_indicator = 'N') "

...
...
queryString = queryString & " " & m_strSql

Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

'Add Parameters

Call AddSQLParameter("@.FSCNUM",intFscn,dbCommand)

'End Add Parameters

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet

Try
lblQuery.Text = queryString
dataAdapter.Fill(dataSet)

'Catch SQLex As System.Data.SqlClient.SqlException
' lblFeedback.Text = "SQL Error: " & SQLex.Message & SQLex.Number & "<br />" & queryString
Catch ex as Exception
lblFeedback.Text = "Fatal error: " & ex.Message
End try

return dataSet

In the OnClick of my button...

DataGrid1.DataSource = GetFSCRecords(intFSCN _
, txtINNM.Text _
, txtINA1.Text _
, txtINA2.Text _
, txtINCTY.Text _
, txtINST.Text _
, txtINZIP.Text _
, txtEFF_DT.Text _
, txtEXP_DT.Text _
, intMaxRecords)

DataGrid1.DataBind() <<<< The error occurs here

Hi !

You can check thedataSet.Tables.Cout > 0 ThenreturndataSetelse return null;

I thinks the DataSet return have Count = 0 .Smile