Web Forms :: Show "no Results" Message If Db Query Returns Nothing
Sep 16, 2010
I inherited some C# code behind that queries a database table and need to add something that displays a "No results" message (using a Label web control, perhaps) if the query doesn't return any records. I'm just learning C# but am coming up short on how to do this. Would anyone be kind enough to point me to an example, or demonstrate? Here's the code I inherited (the programmer who wrote this is no longer available). This is the code behind from the search results page:
[Code]....
View 8 Replies
Similar Messages:
Sep 15, 2010
I have a .Net 4 Chart Control bound to stored proc. For some customer selected queries the chart will be empty. I would like to display a "No data" message in the empty charting area so customers understand why the chart is empty. I haven't been able to find any information about how to do this.
View 1 Replies
Jul 6, 2010
I have a datasource (which is a query) that could run more than 30 secs. I want to show to a user an animated icon (I have it already) while the Gridview is waiting to return data.
I studied several tutorials and textbooks but all just "thoerectically" use a timer to simulate, without much application to real example above. How should I code it in the above real scenario ? In which event handler to put the code and what control (Update panel) to use and any sample code ?
View 6 Replies
Jun 25, 2012
I have a function which returns dataset after execution of sql statements
If the dataset retruns rows than he data shld be dislayed in reporting services
Else display no rows avaliable
But currently even if there are no rows as per the given condition, the earlier data gets displayed
View 1 Replies
Oct 20, 2010
i need to be able to reset a HiddenField's value if my AutoCompleteExtender returns no results (specifically, if the user searches for something that's not in the list/database). I have this JS code now:
[Code]....
How would I modify this to check if the list is null? Currently it seems to just leave the value as it was previously.
View 1 Replies
Oct 14, 2010
How can I SELECT second if first SELECT returns nothing?
View 8 Replies
Jul 2, 2010
I am actually using 2 type of queries in my website e.g
These Queries are from my stored procedures
SELECT * FROM TblName WHERE FREETEXT(ColumnName, @parameter)
AND
SELECT * FROM TblName WHERE CONTAINS((Column1, Column2), @parameter))
I have enabled Full Text Indexing on my tables both local and on my hosting company MS SQL Server.
The above queries are working fine on my local database and return results but these queries return nothing when i try to run them on hosting company MS SQL Server.
I have identical data on both MS SQL Servers and both servers are 2008.
View 2 Replies
Mar 18, 2010
i have a function which returns a value from a query string parameter, i use it in more than 10 places in the webapp thus i have to rewrite the code every time, again and again.so to make it short, is there any way i can embed the code somewhere and keep referring to it through out my app?
View 10 Replies
May 7, 2015
i want if i search UserName 'xdeeeee' that is not exist in database then a label should display saying "Sorry ‘USER NAME’ not found".
have a look below picture.
<asp:TextBox ID="SearchByUserName" runat="server"></asp:TextBox>
<asp:Button ID="SearchByTagButton" runat="server" Text="SEARCH" OnClick="SearchByTagButton_Click" /><br />
[Code].....
View 1 Replies
Jan 26, 2010
I want to display sql query results in my web application (asp.net webpage) dynamically at the run time. But I don't know how to do that. Is there any control to do that? Or is there any code? Could you give some examples?
View 4 Replies
Jun 8, 2010
I am developing a web form for search capability. The search query should return records from three different tables. How to display these three table records in three different rows. The search query should get the results from Table 1 and Table 2. Table 2 and Table 3 has a parent child relation ship. Which controls can I use for this purpose?
View 5 Replies
Aug 19, 2010
i am using create user wizard and capturing other information within content template when a new userregisters. Some of the textboxes are binded to required field validators.there is a validation control on the page and ShowMessage box is True.If they dont complete some of the text boxes then the message box pops Up with the error message.It does not however include information errors like "User already exists" or Email address already existsfrom the create user wizard membership UserName and Password Textboxesis it possilbe to hook all of these up so I get one message box with all errors including membership ones?
View 3 Replies
Jul 29, 2010
(Mods, move if I put this in the wrong place) I'm running queries against SQL databases, and I'd like for the results of my searches to appear in table form in an email that is then sent out dynamically. I currently have the results appearing in a Datagrid on a webpage which I'm then manually transferring to an email form to send. I'd like to streamline the process so I don't need to do any manual entry.
How can I have a table/datagrid/whatever in an email that gets populated with the results of a SQL query?
View 1 Replies
Apr 12, 2010
here is my code:
My sql query is returning 2 rows by my repeater is only displaying 1.
[Code]....
View 3 Replies
Aug 11, 2010
I have a gridview that I want to bind the results of a query to it once a user selects a value from a drop down list.
The query selects the same row from the same table but selects different fields based on the drop down list value selected
I get to the query selection but it does not refresh that page with the populated gridview.
Here's the code behind code
protected void ddlQuantity_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection connection = null;
connection = new SqlConnection(ConfigurationManager.ConnectionStrings["PSI_DB_1ConnectionString"].ConnectionString.ToString());
connection.Open();
String nEstno = Request.QueryString["id"];
int id = Convert.ToInt32(Request.QueryString["id"]);
string SQLquery = "";
switch (int.Parse(ddlQuantity.Text))
{
case 1:
SQLquery = "Select Quan1"etc...;
break;
case 2:
SQLquery = "Select Quan2"etc...;
break;
case 3:
SQLquery = "Select Quan3"etc...;
break;
case 4:
SQLquery = "Select Quan4"etc...;
break;
case 5:
SQLquery = "Select Quan5"etc...;
break;
}
SqlCommand Cmd = new SqlCommand(SQLquery, connection);
SqlDataReader Dr = Cmd.ExecuteReader();
if (Dr.HasRows)
{
gvEstQty.DataBind();
}
Cmd.Dispose();
connection.Close();
connection.Dispose();
}
View 2 Replies
Oct 12, 2010
I have a routine that submits a SOAP request using HttpWebRequest and WebResponse. If the SOAP Request fails the server sends back HTTP/1.1 500 Internal Server Error. When I trap the error I have yet to find a way to view the body of the reply which contains the fault code. Is there a way to retrieve the message body when the server returns a 500 internal Server Error? In body of the reply which I am not able to retrieve.
faultstring xml:lang="en-US" Specified argument was out of the range of valid values.
View 1 Replies
Jan 12, 2010
I have a WCF client test harness where I'm using a "client message inspector" endpoint behavior to "pick off" raw requests and response messages going to and from a service and save them for later display in the UI.
This works great, except for the use case where invalid credentials are passed (Basic Authentication). The server returns an HTTP 401 along with a SOAP fault in the body containing details of what happened. I have no control over the service, so this behavior cannot be changed.
Because the HTTP 401 is returned as a WebException, my message inspector never fires and I can't get to the raw response. This exception eventually gets to the UI in the form a MessageSecurityException.
Is there any way to suppress this so the message inspector's AfterReceiveReply still fires? or is there somewhere else I can access the entire raw response?
View 1 Replies
Apr 29, 2010
[Code]....
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace find.Admin
{
public partial
class WebForm1 : System.Web.UI.Page
{
private
class servicetimeofday
{
public int servicetimeofdayid {
get; set; }
public int serviceid {
get; set; }
public int timeofdayid {
get; set; }
}
protected void Page_Load(object sender,
EventArgs e
{
List<servicetimeofday> servicetimesofday =
new
List<servicetimeofday>
{
new servicetimeofday() { servicetimeofdayid = 1, serviceid = 1, timeofdayid = 1 },
new servicetimeofday() { servicetimeofdayid = 2, serviceid = 1, timeofdayid = 2 },
new servicetimeofday() { servicetimeofdayid = 3, serviceid = 2, timeofdayid = 1 },
new servicetimeofday() { servicetimeofdayid = 4, serviceid = 2, timeofdayid = 3 }
};
GridView2.DataSource = servicetimesofday;
GridView2.DataBind();
var itemstocheck = from
servicetimeofday in servicetimesofday
where servicetimeofday.serviceid == 2
select ne
servicetimeofday.timeofdayid
};
GridView3.DataSource = itemstocheck;
GridView3.DataBind();
foreach (var timeofdayid
in itemstocheck)
{
foreach (ListItem i
in CheckBoxList2.Items)
{
if (i.Value == timeofdayid.ToString())
{ i.Selected =
true; }
}
}
}
}
}
View 10 Replies
Feb 28, 2011
I need to export SQL query results to an Excel file.
I use the following code to do it.
[Code]....
Works fine for majority of the cases. There is a column called Description in the query results which is of type nText in the sql database. This can have lengthy data ( couple fo paragraphs) . When the number of charcters are large only the first portion of the data is showed and it trims the rare portion. how I can avoid this? Or any efficient code example on how I can do this in a different manner
View 1 Replies
Apr 18, 2013
The query I used here is
SELECT top '"+lblCount.text+"' Company_Id, CompanyName, All_Countries,All_Industries,Employees,Revenue, Status FROM SN001CompanyTable where Client_Id=100 ORDER BY [Company_Id] DESC
but its not showing proper results..
In this lblCount contains the no of row to be displayed..
View 1 Replies
Mar 25, 2010
I have a gridview on a page with search boxes at the top.
The wildcard for these is % so in every serach box I set the default to be % so that when the page loads all records are shown and then they can be narrowed down by what you search for but when the page opens the gridview does not show all results.
Here is my code:
<%@ Page language="C#" masterpagefile="MainContent.master" title="Electrical Storage" EnableEventValidation="false" %>
<asp:Content id="Content1" runat="server" contentplaceholderid="Content">
<div id="Rightside">
<h2>Search Electrical Storage
[Code].....
View 4 Replies
Jan 21, 2010
I'm working on a job seeking website where the job seeker can search for a job , the search box is located in the master page, that's why i passed the keywords as a query string, and then the matching jobs will be displayed in a listview.
the keywords will be taken from two controls: a drop down list which the user can choose the location of the job, and a text box where he can type a keyword.
the select command of the sqlDataSource of the data list is as the following:
[code]....
View 4 Replies
Jun 17, 2010
I have 2 gridviews on a webpage that are fully editable. I also have a button, that when clicked, runs some SQL in codebehind to insert new rows into a data table. The gridview should then update with the latest results of the SQL query, which is does.
Then the user clicks on to the next page to do the next thing.The problem is, when they go back to the first page, they're still seeing the old, non-updated data. I've run the SQL from the page manually on the server, and the new data is there, but the GridView doesn't want to pull it.
View 2 Replies
May 21, 2010
I have this code:
Dim Result As New DataTable
DataAdapter.Fill(Result)
'bind data to visible surname/name grid
If Result.Rows.Count = 0 Then
NoInputBottom.Text = "No Results. Please widen your search criteria and try again"
NoInputTop.Text = "No Results. Please widen your search criteria and try again"
Else
GV.DataSource = Result
GV.DataBind()
End If
I have also tried moving the check to the gridview like so:
If GV.Columns.Count = 0 Then
NoInputBottom.Text = "No Options Selected: Please select your search criteria and try again" NoInputTop.Text = "No Options Selected: Please select your search criteria and try again" End If
When I run the code. the noinput labels do not have value, the null check seems to be failing? how to display a message if the search returned no reults.
View 1 Replies
Oct 26, 2010
I have the following line on my aspx page..
[Code]....
My issue is, that i only need this to display when my datalist is displayed and has records.. every time else, it needs to be hidden ( Visible = false ) on page_load i have it set to
btnAddVideo.Visible = false;
btnAddVidCart.Visible = false;
Should i only be check then within my dropdown event? By default the page is displaying my datalist, so it should be hidden.. then you have a dropdown to make a selection, if you change it, then it should show ONLY if there are records to be displayed.
View 12 Replies