Problems using UpdateProgress - c#

I have a button on my ASP.NET page, which fetches some data from my database and displays it on a gridview.
This process takes a while, so I thought I'll add an updateprogress AJAX control. Now when I click the button, the updateprogress image shows up and data is being fetched from my database successfully (I checked this from some logs that I have in my DB). But there are 2 issues:
(1) The updateprogress image shows only for about 2 minutes. But my buttonclick event takes about 5 minutes to complete. Basically the updateprogress stops showing up even before my task is complete, which defeats its purpose.
(2) GridView doesn't show up. It shows up correctly if I don't use scriptmanager/AJAX.
Any ideas?
Some relevant code snippets:
<div style="position: absolute; top: 300px; left: 19px; width: 568px; height: 48px;">
<table>
<tr>
<td>
<asp:Button ID="btnGenerateReport" runat="server" Height="37px" Text="Generate Report"
Width="132px" onclick="btnGenerateReport_Click" />
</td>
<td class="style5">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel runat="server" id="Panel">
<ContentTemplate>
<asp:UpdateProgress ID="PageUpdateProgress" runat="server">
<ProgressTemplate>
<img runat="server" src="updateprogress.gif"
style="position: static; width: 32px;"> </img></ProgressTemplate>
</asp:UpdateProgress>
<div style="position: absolute; top: 423px; left: 9px; width: 795px; height: 984px;">
<asp:GridView ID="Report" runat="server"
AllowSorting="True" AutoGenerateColumns="False"
Height="622px" BorderStyle="Solid"
Width="779px" PageSize="100" HorizontalAlign="Center">
<Columns>
<asp:BoundField HeaderText="AccountId" DataField="AccountId">
<ControlStyle BorderStyle="Solid" Width="20px" />
</asp:BoundField>
<asp:BoundField HeaderText="User Name" ReadOnly="True" DataField="UserName">
<ControlStyle Width="50px" />
</asp:BoundField>
<asp:BoundField HeaderText="C2" ReadOnly="True"
DataField="C2">
<ControlStyle BorderStyle="Solid" Width="20px" />
</asp:BoundField>
<asp:BoundField HeaderText="C1" ReadOnly="True"
DataField="C1">
<ControlStyle BorderStyle="Solid" Width="20px" />
</asp:BoundField>
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnGenerateReport" EventName="click" />
</Triggers>
</asp:UpdatePanel>
</td>
<td>
<asp:Button ID="btnExportToExcel" runat="server" Text="Export To Excel"
Height="37px" Width="132px" onclick="btnExportToExcel_Click" />
</td>
</tr>
</table>
</div>
Codefile part:
protected void btnGenerateReport_Click(object sender, EventArgs e)
{
FetchAccounts();
long startId = FetchAuditData();
AggregateAuditData(startId);
dsAnalysisReport = GenerateDataSet();
if (dsAnalysisReport == null || dsAnalysisReport.Tables.Count == 0)
lblErrorText.Text = "No Data Found for the input information";
else
BindData(dsAnalysisReport);
}
public void FetchAccounts()
{
using (var sqlConnection = new SqlConnection(ConnectionString))
{
sqlConnection.Open();
cmdstring = #"[spo_FetchAccounts]";
cmd = new SqlCommand(cmdstring, sqlConnection) { CommandType = CommandType.StoredProcedure };
cmd.CommandTimeout = 100000;
cmd.Parameters.Add("#MaxActivationDate", SqlDbType.DateTime);
cmd.Parameters["#MaxActivationDate"].Value =
DateTime.Parse(txtStartDate.Text) - new TimeSpan(1, 0, 0, 0);
cmd.ExecuteNonQuery();
sqlConnection.Close();
}
}
public long FetchAuditData()
{
using (var sqlConnection = new SqlConnection(ConnectionString))
{
sqlConnection.Open();
cmdstring = #"[spo_GetComparisonData]";
cmd = new SqlCommand(cmdstring, sqlConnection) { CommandType = CommandType.StoredProcedure };
cmd.CommandTimeout = 100000;
cmd.Parameters.Add("#StartDate", SqlDbType.DateTime);
cmd.Parameters["#StartDate"].Value = txtStartDate.Text;
cmd.Parameters.Add("#EndDate", SqlDbType.DateTime);
cmd.Parameters["#EndDate"].Value = txtEndDate.Text;
SqlParameter returnValue = new SqlParameter("#Return_Value", SqlDbType.BigInt);
returnValue.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(returnValue);
cmd.ExecuteNonQuery();
long startId = long.Parse(cmd.Parameters["#Return_Value"].Value.ToString());
sqlConnection.Close();
return startId;
}
}
private void AggregateAuditData(long startId)
{
using (var sqlConnection = new SqlConnection(ConnectionString))
{
sqlConnection.Open();
cmdstring = #"[spo_ComparisonTable]";
cmd = new SqlCommand(cmdstring, sqlConnection) { CommandType = CommandType.StoredProcedure };
cmd.CommandTimeout = 100000;
cmd.Parameters.Add("#StartId", SqlDbType.Int);
cmd.Parameters["#StartId"].Value = startId;
cmd.ExecuteNonQuery();
sqlConnection.Close();
}
}
public DataSet GenerateDataSet()
{
using (var sqlConnection = new SqlConnection(ConnectionString))
{
sqlConnection.Open();
cmdstring = #"SELECT * FROM XAccounts";
cmd = new SqlCommand(cmdstring, sqlConnection);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
sqlConnection.Close();
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
return ds;
return null;
}
}
private void BindData(DataSet ds)
{
BindReportGrid(Report, ds.Tables[0]);
}
private void BindReportGrid(GridView gridToBind, DataTable dataTableToBind)
{
gridToBind.DataSource = dataTableToBind;
gridToBind.DataBind();
}

As per issue (1) most likely it is ajax timing out. Default timeout is 90 seconds. To increase that use ScriptManager's AsyncPostBackTimeout property:
<asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="400">
</asp:ScriptManager>
If ajax call is timing out, controls on the page might not work correctly so increasing timeout might solve problem (2) as well.

I have had very same problems with ASP.NET UpdateProgress. I fixed it by handling script manager events directly:
<script language="javascript" type="text/javascript">
//adding event handlers for ajax initialize request and end request
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(ShowHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(HideHandler);
function ShowHandler(sender, args) {
//show div with animation
pcProcessing_ClientInstance.Show();
}
function HideHandler(sender, args) {
//hide div with animation
pcProcessing_ClientInstance.Hide();
}
</script>

Maybe you want this: http://www.codeproject.com/kb/Ajax/ModalUpdateProgress.aspx
It works well for me, even with lengthy operations.

Seems like your grid is outside the Update panel, if you are using a update panel and you button is inside the update panel and grid is outside the update panel in that case everything will happen at server side but you will not find any changes in the UI.
Try to place your grid inside the update panel.

Move the UpdateProgress outside of the UpdatePanel.

Related

Insert hyperlinks in Gridview table c# from uploaded excel file

I am building a news page in a web tool using c# and visual studio. The idea is that you upload news in a specific excel format (newsID, Date, Header and text columns) and can view it in the web tool.
I managed to be able to upload the news, store it in a database table and print the news in a Gridview table with three columns: date, header and text. See the below screenshot:
My problem: is that currently I can only print plain text in the Gridview table; but I want to be able to insert hyperlinks in the text column. Is it possible to do this without hard-coding the full HTML for the link into the news message before uploading it?.
This is my default.aspx part of the table:
<div style="width: 100%; height: 400px; overflow-y: scroll">
<asp:GridView CssClass="gridview" ID="News" runat="server" AutoGenerateColumns="false" ShowHeader="False">
<Columns>
<asp:BoundField DataField="Date" ItemStyle-Width="150px" ItemStyle-VerticalAlign="Top"/>
<asp:BoundField DataField="Header" ItemStyle-VerticalAlign="Top"/>
<asp:TemplateField >
<ItemTemplate>
<div class="centered" style="width: 800px; overflow: auto; word-break: break-word; word-wrap: break-word; height: 70px;">
<%# Eval("Text")%>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
And this the c# code behind in default.aspx.cs:
public partial class _Default : Page
{
public void Page_load(object sender, EventArgs e)
{
// Enable News page only for logged in users
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
GetData();
}
}
protected void GetData()
{
News.Columns[0].Visible = true;
string Connection = ConfigurationManager.ConnectionStrings["Connection"].ConnectionString;
using (SqlConnection con = new SqlConnection(Connection))
{
using (SqlCommand cmd = new SqlCommand("SELECT [Date], [Header], [Text] FROM [ART].[News Indicator] ORDER BY [NewsID] DESC"))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
DataSet ds = new DataSet();
sda.Fill(ds);
News.DataSource = ds;
News.DataBind();
}
}
}
}}}
If you set the AutoGenerateColumns property to False, you have a lot of control over the columns and you can control the content.
Then use ItemTemplate with HyperLink:
<asp:GridView AutoGenerateColumns="False">
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink NavigateUrl='www.microsoft.com' Text='Whatever you want to be visible'/>
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
Now the user sees on the screen the value of the Text property, but on click it takes him to page which is the value of NavigateUrl.

Displaying Data from SQL Server database in an ASP.NET table

From searching the internet for a short time I was able to write this code for an internal application I will be developing using Visual Studio ASP.NET / C#.
I am calling the database and creating a connection and then building a dropdown selection from the SQL code used.
Being very new to C# I am struggling to bring other fields into my table (e.g. Text strings and numbers and not just having a drop down field.
Ideally I'd like to show data like:
Activity | Hazards | Controls | RiskLevel(Dropdown)|
Here is my front end code:
<asp:Table ID="Table1" runat="server" Font-Size="Medium" Width="960" BorderWidth="3" CellPadding="5" CellSpacing="5" CssClass="table table-bordered table-striped table-hover table-condensed table-responsive">
<asp:TableHeaderRow runat="server" Font-Bold="true">
<asp:TableHeaderCell ID="ActivityID" Width="20%">Activity</asp:TableHeaderCell>
<asp:TableHeaderCell ID="HazardsID">Hazards</asp:TableHeaderCell>
<asp:TableHeaderCell ID="RiskID" Width="15%">Risk Level</asp:TableHeaderCell>
</asp:TableHeaderRow>
<asp:TableRow ID="TableRow1" runat="server" >
<asp:TableCell><asp:Label ID="lblActivity" runat="server" Text="Label"></asp:Label></asp:TableCell>
<asp:TableCell><asp:Label ID="lblHazards" runat="server" Text="Label"></asp:Label></asp:TableCell>
<asp:TableCell><asp:DropDownList ID="ddl1" runat="server"></asp:DropDownList></asp:TableCell>
</asp:TableRow>
<asp:TableFooterRow runat="server" >
<asp:TableCell ColumnSpan="3" HorizontalAlign="Right" Font-Italic="true">
INSERT **TEXTBOX FOR OTHER INFORMATION ATTACHED HERE!**
</asp:TableCell>
</asp:TableFooterRow>
</asp:Table>
Here is my current back end code:
if (!this.IsPostBack)
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd =
new SqlCommand("SELECT TOP 1000 [MainActivityID],[ID],[Activity],[Hazards],CASE WHEN [Risk_Level] LIKE 'H' THEN 'HIGH' WHEN [Risk_Level] LIKE 'M' THEN 'MEDIUM' WHEN [Risk_Level] LIKE 'L' THEN 'LOW' WHEN[Risk_Level] LIKE 'T' THEN 'TRIVIAL' WHEN[Risk_Level] LIKE 'N' THEN 'N/A' END AS[Risk_Level],[Controls] FROM [STRIDES_SQL].[dbo].[STRIDES_RA_Activities]"))
{
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
ddl1.DataSource = cmd.ExecuteReader();
ddl1.DataTextField = "Risk_Level";
ddl1.DataValueField = "MainActivityID";
ddl1.DataBind();
String input = lblActivity.Text;
con.Close();
}
}
ddl1.Items.Insert(0, new ListItem("--Select Risk Level--", "0"));
}

Cannot Exit Telerik Radgrid Edit Mode after clicking btnInsert?

I'm having trouble exiting edit mode after performing an insert. Inserting isn't done through radgrid but passively through the code behind. I tried everything but I can't exit after completing the insert.
protected void btnInsertUpdate_Click(object sender, EventArgs e)
{
RadButton btnInsert = (RadButton)sender;
RadTextBox txtVisited = (RadTextBox)btnInsert.Parent.FindControl("txtVisited");
RadTextBox txtDays = (RadTextBox)btnInsert.Parent.FindControl("txtDays");
if (txtVisited.Text != "" & txtDays.Text != "" & !IsAsync)
{
string RECORD_UID = ds_01.InsertParameters["RECORD_UID"].DefaultValue;
string VISITED = txtVisited.Text;
string DAYS_ON_SITE = txtDays.Text;
DB db = new DB();
SqlCommand cmd = new SqlCommand();
db.ActiveDBConn = "dbConnection";
cmd.CommandText = "ACP_CANADA_INSERT_NEW_RECORD_DETAILS";
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("UID", RECORD_UID);
cmd.Parameters.AddWithValue("VISITED", VISITED);
cmd.Parameters.AddWithValue("DAYS_ON_SITE", DAYS_ON_SITE);
db.SQLStatement = cmd;
db.NonQuery();
radgrid_1.MasterTableView.ClearEditItems();
}
}
<EditFormSettings EditFormType="Template" FormStyle-BackColor="#e1eaff" FormStyle-BorderColor="#006699" FormStyle-BorderWidth="10">
<FormTemplate>
<div style="padding: 10px;">
<div>
<telerik:RadLabel ID="lblVisited" runat="server" Text="Visited:"></telerik:RadLabel>
<telerik:RadTextBox ID="txtVisited" runat="server"></telerik:RadTextBox>
<br />
<br />
<telerik:RadLabel ID="lblDays" runat="server" Text="Days on Site:"></telerik:RadLabel>
<telerik:RadTextBox ID="txtDays" runat="server"></telerik:RadTextBox>
</div>
<br />
<br />
<telerik:RadButton id="btnInsertUpdate" runat="server" Text="Insert" OnClick="btnInsertUpdate_Click"></telerik:RadButton>
<telerik:RadButton id="btnCancel" text="Cancel" runat="server" causesvalidation="False" CommandName="Cancel"></telerik:RadButton>
</div>
</FormTemplate>
</EditFormSettings>
Adding the CommandName equal to "Cancel" gives me the behavior I'm looking for...Insert is performed to the database and I get to exit out of edit mode.
<telerik:RadButton id="btnInsert" runat="server" Text="Insert" OnClick="btnInsert_Click" CommandName="Cancel"></telerik:RadButton>

How to change listview data with multiply checkbox checked?

I want change the listview data with checkboxlist items. But when checked 2 or multiply items write this error:
The variable name '#TId' has already been declared.
or
Index was outside the bounds of the array.
Please help me. :(
HTML:
<asp:ListView ID="ltvProduct" runat="server">
<ItemTemplate>
<asp:HyperLink runat="server" ID="hypProduct" NavigateUrl='<%#"show.aspx?NId="+Eval("MId") %>'>
<div class="col-lg-4 Border Text PContainer ">
<asp:Image runat="server" ImageUrl='<%#"/img/Gallery/"+Eval("PicUrl") %>' CssClass="padding-product" Width="240px" /><br />
<asp:Label ID="lblName" runat="server" Text='<%#Eval("Name") %>' CssClass="EnName"></asp:Label><br />
</div>
</asp:HyperLink>
</ItemTemplate>
</asp:ListView>
CHECKBOX BIND CODE:
SqlConnection conT = new SqlConnection(ConfigurationManager.ConnectionStrings["CSTR"].ConnectionString);
SqlCommand cmT = new SqlCommand("Select * from Type", conT);
SqlDataAdapter adpT = new SqlDataAdapter(cmT);
DataTable dtT = new DataTable();
adpT.Fill(dtT);
chkType.DataSource = dtT;
chkType.DataTextField = "Name";
chkType.DataValueField = "TId";
chkType.DataBind();
SELECTEDINDEXCHANGE:
string strconnectionP = ConfigurationManager.ConnectionStrings["CSTR"].ConnectionString;
SqlConnection objconnectionP = new SqlConnection(strconnectionP);
string strsqlP = "select * from Model where TId=#TId";
SqlCommand objcommandP = new SqlCommand(strsqlP, objconnectionP);
for (int i = 0; i < chkType.Items.Count; i++)
{
if (chkType.Items[i].Selected)
{
objcommandP.Parameters.AddWithValue("#TId", chkType.SelectedValue[i]);
objconnectionP.Open();
ltvProduct.DataSource = objcommandP.ExecuteReader();
ltvProduct.DataBind();
}
objconnectionP.Close();
}
}
In your SELECTEDINDEXCHANGE event you are executing your SqlCommand inside a loop for multiple times. If you want to use a SqlCommand multiple times you should clear your parameter everytime after executing SqlCommand. Use this line of code
objcommandP.Parameters.Clear();
Ater these lines
ltvProduct.DataSource = objcommandP.ExecuteReader();
ltvProduct.DataBind();

Perform a SQL query search based on one or both user inputs and populate a grid view with the results

I am working on a small search form that has two text fields: One that allows users to search for a job list (which is basically a wish list--don't know why they want to call it a "job list" but whatever) by entering in part of or a full email address or someone's first and/or last name (This textbox is called SearchName). This field is required and if it is blank when the user hits "Search," an error message appears telling them so. The second textbox is optional, and it allows users to enter in a city or a state to help narrow their search down even more (this textbox is called SearchLocation).
I have a function (called getJobLists()) that is used by the search button to get results.
As it is right now, the part of the function that returns results based on what is entered into the SearchName field works perfectly. However, I cannot get any results for SearchLocation. When I enter a valid email or name into SearchName, then enter a valid city or state into SearchLocation, I get no results. However, if I enter in anything invalid (i.e. a city that is not associated with the entered email or name) the "no results found" message does appear.
I have tested both SQL queries in my search function in SQL Server Management Studio and they do work perfectly.
I have a try-catch inside the search function, but no error is being shown, not even in the console.
This is the code behind:
protected void Page_Load(object sender, System.EventArgs e)
{
// CHECK IF THE WISHLIST SEARCH ENABLED
StoreSettingsManager settings = AbleContext.Current.Store.Settings;
if (!settings.WishlistSearchEnabled)
{
Response.Redirect(AbleCommerce.Code.NavigationHelper.GetHomeUrl());
return;
}
}
protected void getJobLists()
{
try
{
if (SearchName.Text != "")
{//if SearchName.Text is not blank
if (SearchLocation.Text != "")
{//check to see if SearchLocation.Text is not blank either
string sqlSelect = "SELECT (FirstName +' '+ LastName) AS 'FullName', UserName, (Address1 + ', ' +City + ', ' + Province) AS 'Address' FROM ac_Users INNER JOIN ac_Wishlists ON ac_Wishlists.UserId = ac_Users.UserId INNER JOIN ac_Addresses ON ac_Addresses.UserId = ac_Wishlists.UserId WHERE IsBilling ='true' AND (UserName LIKE '%'+#UserName+'%' OR (FirstName + LastName) LIKE '%'+#UserName+'%') AND ((City + Province) LIKE '%'+#Location+'%')";
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["AbleCommerce"].ToString()))
{
SqlCommand cmd = new SqlCommand(sqlSelect, cn);
cmd.Parameters.AddWithValue("#UserName", String.Format("%{0}%", SearchName.Text));
cmd.Parameters.AddWithValue("#Location", String.Format("%{0}%", SearchLocation.Text));
cmd.CommandType = CommandType.Text;
cn.Open();
DataSet ds = new DataSet();
DataTable jobsListsTbl = ds.Tables.Add("jobsListsTbl");
jobsListsTbl.Columns.Add("User", Type.GetType("System.String"));
jobsListsTbl.Columns.Add("PrimaryAddress", Type.GetType("System.String"));
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
DataRow dr = jobsListsTbl.NewRow();
dr["User"] = reader["Name"];
dr["PrimaryAddress"] = reader["Address"];
jobsListsTbl.Rows.Add(dr);
}
}
WishlistGrid.DataSource = ds;
WishlistGrid.DataMember = "jobsListsTbl";
WishlistGrid.DataBind();
}
}//end of if(SearchLocation.Text !='')
else
{//if SearchLocation.Text is blank, then go with this code instead
string sqlSelect2 = "SELECT (FirstName +' '+ LastName) AS 'FullName', UserName, (Address1 + ', ' +City + ', ' + Province) AS 'Address' FROM ac_Users INNER JOIN ac_Wishlists ON ac_Wishlists.UserId = ac_Users.UserId INNER JOIN ac_Addresses ON ac_Addresses.UserId = ac_Wishlists.UserId WHERE IsBilling ='true' AND (UserName LIKE '%'+#UserName+'%' OR (FirstName + LastName) LIKE '%'+#UserName+'%')";
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["AbleCommerce"].ToString()))
{
SqlCommand cmd = new SqlCommand(sqlSelect2, cn);
cmd.Parameters.AddWithValue("#UserName", String.Format("%{0}%", SearchName.Text));
cmd.CommandType = CommandType.Text;
cn.Open();
DataSet ds = new DataSet();
DataTable jobsListsTbl2 = ds.Tables.Add("jobsListsTbl2");
jobsListsTbl2.Columns.Add("User", Type.GetType("System.String"));
jobsListsTbl2.Columns.Add("PrimaryAddress", Type.GetType("System.String"));
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
DataRow dr = jobsListsTbl2.NewRow();
dr["User"] = reader["UserName"];
dr["PrimaryAddress"] = reader["Address"];
jobsListsTbl2.Rows.Add(dr);
}
}
WishlistGrid.DataSource = ds;
WishlistGrid.DataMember = "jobsListsTbl2";
WishlistGrid.DataBind();
}
}//end if SearchLocation.Text is empty
}//end of if SearchName.Text !==''
}
catch (Exception x)
{
errors5.Text += "ERROR: " + x.Message.ToString() + "<br />";
}
}
protected void SearchButton_Click(object sender, EventArgs e)
{
WishlistGrid.Visible = true;
getJobLists();
}
And this is the designer code for the search form (Note: the NavigateUrl is not set for the hyperlink yet. I will set it once everything is displaying properly for the search results):
<div id="findWishlistPage" class="mainContentWrapper">
<div class="section">
<div class="introDiv">
<div class="pageHeader">
<h1>Find a Job List</h1>
</div>
<div class="content">
<asp:label id="errors" runat="server" text=""></asp:label>
<asp:label id="errors2" runat="server" text=""></asp:label>
<asp:label id="errors3" runat="server" text=""></asp:label>
<asp:label id="errors4" runat="server" text=""></asp:label>
<asp:label id="errors5" runat="server" text=""></asp:label>
<asp:UpdatePanel ID="Searchajax" runat="server">
<ContentTemplate>
<asp:Panel ID="SearchPanel" runat="server" EnableViewState="false" DefaultButton="SearchButton">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableViewState="false" />
<table class="inputForm">
<tr>
<th class="rowHeader">
<asp:Label ID="SearchNameLabel" runat="server" Text="Name or E-mail:" AssociatedControlID="SearchName" EnableViewState="false"></asp:Label>
</th>
<td>
<asp:Textbox id="SearchName" runat="server" onfocus="this.select()" Width="200px" EnableViewState="false"></asp:Textbox>
<asp:RequiredFieldValidator ID="SearchNameValdiator" runat="server" ControlToValidate="SearchName"
Text="*" ErrorMessage="Name or email address is required." EnableViewState="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<th class="rowHeader">
<asp:Label ID="SearchLocationLabel" runat="server" Text="City or State (optional):" EnableViewState="false"></asp:Label>
</th>
<td>
<asp:TextBox id="SearchLocation" runat="server" onfocus="this.select()" Width="140px" EnableViewState="false"></asp:TextBox>
<asp:LinkButton ID="SearchButton" runat="server" CssClass="button linkButton" Text="Search" OnClick="SearchButton_Click" EnableViewState="false" />
</td>
</tr>
</table><br />
<asp:GridView ID="WishlistGrid" runat="server" AllowPaging="True"
AutoGenerateColumns="False" ShowHeader="true"
SkinID="PagedList" Visible="false" EnableViewState="false">
<Columns>
<asp:TemplateField HeaderText="Name">
<HeaderStyle CssClass="wishlistName" />
<ItemStyle CssClass="wishlistName" />
<ItemTemplate>
<asp:HyperLink ID="WishlistLink" runat="server" >
<%#Eval("User")%>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Location">
<HeaderStyle CssClass="wishlistLocation" />
<ItemStyle CssClass="wishlistLocation" />
<ItemTemplate>
<asp:Label ID="Location" runat="server" Text='<%#Eval("PrimaryAddress")%>'></asp:Label>
<%--'<%#GetLocation(Eval("User.PrimaryAddress"))%>'--%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<asp:Localize ID="EmptySearchResult" runat="server" Text="There were no job lists matching your search criteria."></asp:Localize>
</EmptyDataTemplate>
</asp:GridView>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
Can anyone please tell me what I'm missing or doing wrong?
Okay, I finally solved the issue. Apparently, it was a variable naming issue I kept overlooking. But now it all works okay! :)

Categories

Resources