Click here to Skip to main content
15,917,795 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Browser "Back" Botton - how to control Pin
Not Active19-Apr-10 10:35
mentorNot Active19-Apr-10 10:35 
AnswerRe: Browser "Back" Botton - how to control Pin
Jamil Hallal21-Apr-10 3:17
professionalJamil Hallal21-Apr-10 3:17 
Questionalert message box in update panel Pin
ships_agr19-Apr-10 7:43
ships_agr19-Apr-10 7:43 
AnswerRe: alert message box in update panel Pin
Brij19-Apr-10 8:07
mentorBrij19-Apr-10 8:07 
GeneralRe: alert message box in update panel Pin
ships_agr20-Apr-10 5:28
ships_agr20-Apr-10 5:28 
QuestionServer Error in '/' Application. Pin
Abdul-Rhman Alsri19-Apr-10 7:18
Abdul-Rhman Alsri19-Apr-10 7:18 
AnswerRe: Server Error in '/' Application. Pin
Abhijit Jana19-Apr-10 11:03
professionalAbhijit Jana19-Apr-10 11:03 
QuestionAn Issue with Databind() for a GridView Pin
PDTUM19-Apr-10 6:09
PDTUM19-Apr-10 6:09 
Hello,

I am having an issue returning results to a GridView. After running an Sql Query for the MS SQL 2005 database, I get the following error.

{"A field or property with the name 'Site_Number' was not found on the selected data source."}

The program continues and simply does not post to the grid. A STOP fault check indicates that 4 results were returned for this query and the error happens on the last line of the code below:

[GridViewAeSummary.DataBind()]

Here is the code:

<br />
 //Comm Paramemters<br />
            Comm.Parameters.Clear();<br />
            Comm.Parameters.AddWithValue("@Site_Number", selectedSite);<br />
<br />
            //Create a Dataset<br />
            SqlDataAdapter da = new SqlDataAdapter(Comm);<br />
            da.Fill(ds);<br />
<br />
            //Count Returned Values<br />
            int thisTotal = ds.Tables[0].Rows.Count;<br />
            count = count + thisTotal;<br />
<br />
            //Check for returned results<br />
            if (count < 1)   //No AE's<br />
            {<br />
                title = "0 Results Returned";<br />
                message = "There are no AE's at this site!";<br />
                Session["message"] = message;<br />
                Session["title"] = title;<br />
                Response.Redirect("MessageBox.aspx");<br />
                Session.Remove(message);<br />
                Session.Remove(title);<br />
                return;<br />
            }<br />
<br />
            //Data Grid<br />
            GridViewAeSummary.DataSource = ds.Tables[0].DefaultView;<br />
            GridViewAeSummary.DataBind();<br />
<br />
        }<br />
        catch (Exception ex)  //Catch Errors<br />
        {<br />
            Console.WriteLine("Error : " + ex.Message);<br />
        }<br />


If I run the query using the query tool in Sql 2005, it returns perfectly. I have never seen this error before. Obviously, if the column was not in the data source, it would not return a value to 'count', nor would it work as a database query. I'm confused. Any ideas?

Thank you in advance.

Best Regards, Pat
AnswerRe: An Issue with Databind() for a GridView Pin
PDTUM19-Apr-10 8:00
PDTUM19-Apr-10 8:00 
QuestionAssign themes programmatically - Master Pages Pin
Karan_TN19-Apr-10 4:04
Karan_TN19-Apr-10 4:04 
AnswerRe: Assign themes programmatically - Master Pages Pin
daveyerwin19-Apr-10 5:01
daveyerwin19-Apr-10 5:01 
GeneralRe: Assign themes programmatically - Master Pages Pin
Karan_TN19-Apr-10 16:50
Karan_TN19-Apr-10 16:50 
GeneralRe: Assign themes programmatically - Master Pages Pin
daveyerwin20-Apr-10 5:11
daveyerwin20-Apr-10 5:11 
AnswerRe: Assign themes programmatically - Master Pages Pin
Abhijit Jana19-Apr-10 6:34
professionalAbhijit Jana19-Apr-10 6:34 
GeneralRe: Assign themes programmatically - Master Pages Pin
Karan_TN19-Apr-10 16:51
Karan_TN19-Apr-10 16:51 
GeneralRe: Assign themes programmatically - Master Pages Pin
Abhijit Jana19-Apr-10 20:41
professionalAbhijit Jana19-Apr-10 20:41 
AnswerRe: Assign themes programmatically - Master Pages Pin
Tej Aj19-Apr-10 21:41
Tej Aj19-Apr-10 21:41 
AnswerRe: Assign themes programmatically - Master Pages Pin
Tej Aj20-Apr-10 0:43
Tej Aj20-Apr-10 0:43 
Question"view in browser" shortcut Pin
Yustme19-Apr-10 3:23
Yustme19-Apr-10 3:23 
AnswerRe: "view in browser" shortcut Pin
Abhijit Jana19-Apr-10 6:37
professionalAbhijit Jana19-Apr-10 6:37 
QuestionHow to Dynamically add meta keywords? Pin
123chaminda19-Apr-10 1:35
123chaminda19-Apr-10 1:35 
AnswerRe: How to Dynamically add meta keywords? Pin
Abhijit Jana19-Apr-10 1:41
professionalAbhijit Jana19-Apr-10 1:41 
GeneralRe: How to Dynamically add meta keywords? Pin
123chaminda19-Apr-10 9:30
123chaminda19-Apr-10 9:30 
Questionsolution n-tiers Pin
tek 200919-Apr-10 1:25
tek 200919-Apr-10 1:25 
AnswerRe: solution n-tiers Pin
Not Active19-Apr-10 2:48
mentorNot Active19-Apr-10 2:48 

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.