How to implement EntityDataSource Where IN entity sql clause - entity-framework

I want to pass a number of values into a parameter of the EntityDataSource, e.g.:
Where="it.ORDER_ID IN {#OrderIdList}" (this is a property on the EntityDataSource)
<WhereParameters>
<asp:ControlParameter
Name="OrderIdList" Type="Int16"
ControlID="OrderFilterControl" PropertyName="OrderIdList"
/>
</WhereParameters>
This doesn't work as ORDER_ID is of type int32 and I need to pass in multiple values, e.g. {1,2,3} etc
The next thing I tried was setting the Where clause in code-behind and this all works except I can't get data binding on DropDownLists to work. By this I mean no value is returned from the bound dropdownlists in the EntityDataSource Updating Event.
My ideal solution would be to use a WhereParameter on the EntityDataSource but any help is appreciated. Thanks, Tony.
A complete code example follows using the AdventureWorks db:
Public Class EntityDataSourceWhereInClause
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CustomersEntityDataSource.Where = WhereClause ''# reset after each postback as its lost otherwise
End Sub
Private Sub cmdFilterCustomers_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdFilterCustomers.Click
Dim CustomerIdList As New Generic.List(Of Int32)
For Each item As ListItem In CustomerIdCheckBoxList.Items
If item.Selected Then
CustomerIdList.Add(item.Value)
End If
Next
Dim CustomerCsvList As String = String.Join(", ", CustomerIdList.Select(Function(o) o.ToString()).ToArray())
WhereClause = "it.CustomerID IN {" & CustomerCsvList & "}"
CustomersEntityDataSource.Where = WhereClause
FormView1.PageIndex = 0
End Sub
''# save between postbacks the custom Where IN clause
Public Property WhereClause() As String
Get
Return ViewState("WhereClause")
End Get
Set(ByVal value As String)
ViewState.Add("WhereClause", value)
End Set
End Property
Private Sub CustomersEntityDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.EntityDataSourceChangingEventArgs) Handles CustomersEntityDataSource.Updating
Dim c = CType(e.Entity, EntityFrameworkTest.Customer)
If c.Title.Length = 0 Then
Response.Write("Title is empty string, so will save like this!")
End If
End Sub
End Class
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="EntityDataSourceWhereInClause.aspx.vb"
Inherits="EntityFrameworkTest.EntityDataSourceWhereInClause" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<%''# filter control %>
<div>
<asp:EntityDataSource ID="CustomerIdListEntityDataSource" runat="server" ConnectionString="name=AdventureWorksLT2008Entities"
DefaultContainerName="AdventureWorksLT2008Entities" EnableFlattening="False"
EntitySetName="Customers" Select="it.[CustomerID]" OrderBy="it.[CustomerID]">
</asp:EntityDataSource>
<asp:CheckBoxList ID="CustomerIdCheckBoxList" runat="server" DataSourceID="CustomerIdListEntityDataSource"
DataTextField="CustomerID" DataValueField="CustomerID" RepeatDirection="Horizontal">
</asp:CheckBoxList>
<asp:Button ID="cmdFilterCustomers" runat="server" Text="Apply Filter" />
</div>
<%
''# you get this error passing in CSV in the where clause
''# The element type 'Edm.Int32' and the CollectionType 'Transient.collection[Edm.String(Nullable=True,DefaultValue=,MaxLength=,Unicode=,FixedLength=)]' are not compatible. The IN expression only supports entity, primitive, and reference types. Near WHERE predicate, line 6, column 15.
''# so have coded it manually in code-behind Where="it.CustomerID IN {#OrderIdList}"
%>
<asp:EntityDataSource ID="CustomersEntityDataSource" runat="server" ConnectionString="name=AdventureWorksLT2008Entities"
DefaultContainerName="AdventureWorksLT2008Entities" EnableFlattening="False"
EnableUpdate="True" EntitySetName="Customers"
AutoGenerateOrderByClause="false">
</asp:EntityDataSource>
<%''# updating works with DropDownLists until the Where clause is set in code %>
<asp:FormView ID="FormView1" runat="server" AllowPaging="True" CellPadding="4" DataKeyNames="CustomerID"
DataSourceID="CustomersEntityDataSource" ForeColor="#333333">
<EditItemTemplate>
CustomerID:
<asp:Label ID="CustomerIDLabel1" runat="server" Text='<%# Eval("CustomerID") %>' />
<br />
NameStyle:
<asp:CheckBox ID="NameStyleCheckBox" runat="server" Checked='<%# Bind("NameStyle") %>' />
<br />
Title:
<%''# the SelectedValue is not Bound to the EF object if the Where clause is updated in code-behind %>
<asp:DropDownList ID="ddlTitleBound" runat="server" DataSourceID="TitleEntityDataSource"
DataTextField="Title" DataValueField="Title" AutoPostBack="false" AppendDataBoundItems="true"
SelectedValue='<%# Bind("Title") %>'>
</asp:DropDownList>
<asp:EntityDataSource ID="TitleEntityDataSource" runat="server" ConnectionString="name=AdventureWorksLT2008Entities"
DefaultContainerName="AdventureWorksLT2008Entities" EnableFlattening="False"
EntitySetName="Customers" Select="it.[Title]" GroupBy="it.[Title]" ViewStateMode="Enabled">
</asp:EntityDataSource>
<br />
FirstName:
<asp:TextBox ID="FirstNameTextBox" runat="server" Text='<%# Bind("FirstName") %>' />
<br />
MiddleName:
<asp:TextBox ID="MiddleNameTextBox" runat="server" Text='<%# Bind("MiddleName") %>' />
<br />
LastName:
<asp:TextBox ID="LastNameTextBox" runat="server" Text='<%# Bind("LastName") %>' />
<br />
Suffix:
<asp:TextBox ID="SuffixTextBox" runat="server" Text='<%# Bind("Suffix") %>' />
<br />
CompanyName:
<asp:TextBox ID="CompanyNameTextBox" runat="server" Text='<%# Bind("CompanyName") %>' />
<br />
SalesPerson:
<asp:TextBox ID="SalesPersonTextBox" runat="server" Text='<%# Bind("SalesPerson") %>' />
<br />
EmailAddress:
<asp:TextBox ID="EmailAddressTextBox" runat="server" Text='<%# Bind("EmailAddress") %>' />
<br />
Phone:
<asp:TextBox ID="PhoneTextBox" runat="server" Text='<%# Bind("Phone") %>' />
<br />
PasswordHash:
<asp:TextBox ID="PasswordHashTextBox" runat="server" Text='<%# Bind("PasswordHash") %>' />
<br />
PasswordSalt:
<asp:TextBox ID="PasswordSaltTextBox" runat="server" Text='<%# Bind("PasswordSalt") %>' />
<br />
rowguid:
<asp:TextBox ID="rowguidTextBox" runat="server" Text='<%# Bind("rowguid") %>' />
<br />
ModifiedDate:
<asp:TextBox ID="ModifiedDateTextBox" runat="server" Text='<%# Bind("ModifiedDate") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<ItemTemplate>
CustomerID:
<asp:Label ID="CustomerIDLabel" runat="server" Text='<%# Eval("CustomerID") %>' />
<br />
NameStyle:
<asp:CheckBox ID="NameStyleCheckBox" runat="server" Checked='<%# Bind("NameStyle") %>'
Enabled="false" />
<br />
Title:
<asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' />
<br />
FirstName:
<asp:Label ID="FirstNameLabel" runat="server" Text='<%# Bind("FirstName") %>' />
<br />
MiddleName:
<asp:Label ID="MiddleNameLabel" runat="server" Text='<%# Bind("MiddleName") %>' />
<br />
LastName:
<asp:Label ID="LastNameLabel" runat="server" Text='<%# Bind("LastName") %>' />
<br />
Suffix:
<asp:Label ID="SuffixLabel" runat="server" Text='<%# Bind("Suffix") %>' />
<br />
CompanyName:
<asp:Label ID="CompanyNameLabel" runat="server" Text='<%# Bind("CompanyName") %>' />
<br />
SalesPerson:
<asp:Label ID="SalesPersonLabel" runat="server" Text='<%# Bind("SalesPerson") %>' />
<br />
EmailAddress:
<asp:Label ID="EmailAddressLabel" runat="server" Text='<%# Bind("EmailAddress") %>' />
<br />
Phone:
<asp:Label ID="PhoneLabel" runat="server" Text='<%# Bind("Phone") %>' />
<br />
PasswordHash:
<asp:Label ID="PasswordHashLabel" runat="server" Text='<%# Bind("PasswordHash") %>' />
<br />
PasswordSalt:
<asp:Label ID="PasswordSaltLabel" runat="server" Text='<%# Bind("PasswordSalt") %>' />
<br />
rowguid:
<asp:Label ID="rowguidLabel" runat="server" Text='<%# Bind("rowguid") %>' />
<br />
ModifiedDate:
<asp:Label ID="ModifiedDateLabel" runat="server" Text='<%# Bind("ModifiedDate") %>' />
<br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
Text="Edit" />
</ItemTemplate>
<PagerSettings Position="Top" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
</asp:FormView>
</form>

After many wasted hours I now have it working!
The problem related to FormView paging and by setting AllowPaging to False on Edit everything was ok.
This only occurs when you have the following on the FormView in the HTML:
<PagerSettings Mode="NextPrevious" Position="Top" />
With default paging you don't see the problem.

Alternate work-around below, if paging is disabled and your still having an issue:
Private Sub DetailsView1_ModeChanged(sender As Object, e As System.EventArgs) Handles DetailsView1.ModeChanged
EntityDataSource1.Where = "it.[ID]=" & Me.lstFilter.SelectedValue ' DetailView.Edit work-around for lost context: Reset bound EntityDataSource.Where
Sub

Related

Displaying pre-formatted HTML content in Ionic

I have pre-formatted HTML content (from third Party) that I need to display in Ionic. For example, I have list of questions (pre-formatted html) that I get from DB which I need to display as a list of Ion-Items or Ion-Card in Ionic.
Sample HTML Content from DB:
First Record:
<p>
<span style="color: #eb4924;"><strong>SOME_TEXT_HEADER 1</strong></span><br />
TEXT_DESCRIPTION 1<br />
<span style="color: #339966;"><strong>SOME_COMMENTS_HEADER:</strong></span><br />
SOME_COMMENT_TEXT_1<br />
SOME_COMMENT_TEXT_2<br />
<img src="https://xyx.com/SOME_IMAGE.jpg" alt="ALT_TEXT" width="320" height="116"/>
SOME_COMMENT_TEXT_3<br />
</p>
Second Record
<p>
<span style="color: #eb4924;"><strong>SOME_TEXT_HEADER 2</strong></span><br />
TEXT_DESCRIPTION 2<br />
<span style="color: #339966;"><strong>SOME_COMMENTS_HEADER:</strong></span><br />
SOME_COMMENT_TEXT_1<br />
SOME_COMMENT_TEXT_2<br />
<img src="https://xyx.com/SOME_IMAGE.jpg" alt="ALT_TEXT" width="320" height="116"/>
SOME_COMMENT_TEXT_3<br />
</p>
Third Record:
<p>
<span style="color: #eb4924;"><strong>SOME_TEXT_HEADER 3</strong></span><br />
TEXT_DESCRIPTION 3<br />
<span style="color: #339966;"><strong>SOME_COMMENTS_HEADER:</strong></span><br />
SOME_COMMENT_TEXT_1<br />
SOME_COMMENT_TEXT_2<br />
<img src="https://xyx.com/SOME_IMAGE.jpg" alt="ALT_TEXT" width="320" height="116"/>
SOME_COMMENT_TEXT_3<br />
</p>
...and so on
I want to get suggestions regarding best practices to handle this scenario. Any help would be highly appreciated. Thanks!
You can DomSanitizer from Angular, to display your html.
Html :
<div class="details" [innerHtml]="details">
</div>
</ion-content>
And in your ts :
displayHTML(data){
this.details = this.sanitizer.bypassSecurityTrustHtml(data);
});
Don't forget to declare in the constructor :
public sanitizer: DomSanitizer

How to send data from input using asp-route attribute?

I'm using this code to call controller with action.
I want to send data from input tag inside asp-route-data.
<span><label><b>Korisnik :</b></label></span>
<br />
<input type="text" name="korisnik" id="korisnik" size="40" height="25" />
<br />
<br />
<span><label><b>Lozinka :</b></label></span>
<br />
<input type="password" name="lozinka" id="lozinka" size="40" height="25" />
<br />
<br />
<button type="submit" title="Login" class="btnLogin" asp-controller="Members" asp-route-username=a sp-route-password="" asp-action="LoginUser">
So, asp-route-username should be the value from input korisnik.
Is it possible?
If I understood your question correctly (of which I'm not so sure) I think the answer to your problem is it use <form> tag. Then instead of appling the asp-route attributes on <button> tag, apply them on <form> tag:
<form asp-controller="Members" asp-action="LoginUser" asp-route-username="a" asp-route-password="">
<span><label><b>Korisnik :</b></label></span>
<br />
<input type="text" name="korisnik" id="korisnik" size="40" height="25" />
<br />
<br />
<span><label><b>Lozinka :</b></label></span>
<br />
<input type="password" name="lozinka" id="lozinka" size="40" height="25" />
<br />
<br />
<button type="submit" title="Login" class="btnLogin"></button>
</form>
Be sure to check out the official ASP.NET Core documentation on how to work with forms.
If you pass username and password using asp-route-{value}, it will show these information in the url which is not recommended.
If you just want to pass the two input values from view to controller, you need to modify name attribute of input to match the action parameters.For example:
View:
<form method="post" asp-controller="Members" asp-action="LoginUser">
<span><label><b>Korisnik :</b></label></span>
<br />
<input type="text" name="username" id="korisnik" size="40" height="25" />
<br />
<br />
<span><label><b>Lozinka :</b></label></span>
<br />
<input type="password" name="password" id="lozinka" size="40" height="25" />
<br />
<br />
<button type="submit" title="Login" class="btnLogin"></button>
</form>
Action:
[HttpPost]
public async Task<IActionResult> LoginUser(string username,string password)

HttpServletRequest and forms with java 6

I wrote this code in java 7 and it works without problems.
I'm now trying to use java 6, and it's getting strange : the request object does not have any visible parameter, so I can't access the info I send with the form.
Here is the code :
<%# page pageEncoding="UTF-8"%>
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Thesaurus Builder</title>
<link type="text/css" rel="stylesheet" href="<c:url value="/form.css"/>" />
</head>
<body>
<form action="<c:url value='/' />" method="post" enctype="multipart/form-data"> <!-- accept-charset="UTF-8" -->
<fieldset>
<legend>Analyse de texte</legend>
<label for="file">Fichier à analyser</label>
<textarea rows="7" cols="100" name="file" id="file" ></textarea>
<br />
<br />
<label for="encoding">Encodage</label>
<input type="text" id="encoding" name="encoding" value="UTF-8" />
<br />
<br />
<label for="skos">Choississez un thesaurus</label>
<c:if test="${empty listThesaurus}">
<input type="text" id="skos" name="skos" value="No thesaurus avalaible" disabled = "disabled"/>
</c:if>
<c:if test="${not empty listThesaurus}">
<select id="skos" name="skos" >
<c:forEach var="item" items="${listThesaurus}">
<option value= "<c:out value="${item.key}/${item.value}" />" ><c:out value="${item.key} - ${item.value}" /></option>
</c:forEach>
</select>
</c:if>
<br />
<br />
<label for="model">Choississez un model (temp)</label>
<c:if test="${empty listModel}">
<input type="text" id="encoding" name="encoding" value="No model avalaible" disabled = "disabled"/>
</c:if>
<c:if test="${not empty listModel}">
<select id="model" name="model" >
<c:forEach var="item" items="${listModel}">
<option value= "<c:out value="${item.key}/${item.value}}" />" ><c:out value="${item.key} - ${item.value}" /></option>
</c:forEach>
<c:if test="${empty listModel}"></c:if>
</select>
</c:if>
<br />
<br />
<br />
<label for="debug">Mode Debug</label>
<input type="checkbox" id="debug" name="debug"/>
<br />
<br />
<input type="submit" value="Envoyer" class="sansLabel" />
<br />
</fieldset>
</form>
<c:if test="${not empty param.debug }">
<c:if test="${not empty debug }">
<p class="debug"><c:forEach items="${debug}" var="e">${e}<br/></c:forEach></p>
</c:if>
</c:if>
<c:if test="${not empty errors}">
<p class="error"><c:forEach items="${errors}" var="e">${e}<br/></c:forEach></p>
</c:if>
<c:if test="${not empty tags}">
<h3>Résultat Etude stockastique :</h3>
<div id="tagCLoud">
<h4>Tag Cloud </h4>
<c:forEach items="${tags}" var="tag">
<span style ="margin-right: 64px"><span class = "tags" style = "font-size: ${tag.value[1]};"><c:out value = "${tag.key}"/></span>(${tag.value[0]})</span>
</c:forEach>
</div>
<div id="coocurrence">
<h4>Co-occurrence </h4>
<c:forEach var = "i" begin="0" end="${ fn:length(coocurrence) -1}">
<c:forEach var = "j" begin="0" end="${ fn:length(coocurrence[i]) -1}">
<c:choose>
<c:when test="${j == 0}">
<c:out value="${coocurrence[i][j]} :"/><br>
</c:when>
<c:otherwise>
<span style ="margin-left: 30px">- <c:out value="${coocurrence[i][j]}"/></span><br>
</c:otherwise>
</c:choose>
</c:forEach>
<br>
</c:forEach>
</div>
<br>
<br>
<div id="concordance">
<h4>Concordance </h4>
<c:forEach var = "i" begin="0" end="${ fn:length(concordance) -1}">
<c:forEach var = "j" begin="0" end="${ fn:length(concordance) -2}">
<c:choose>
<c:when test="${j == 0}">
<c:out value="${concordance[i][j]} :"/><br>
</c:when>
<c:otherwise>
<span style ="margin-left: 30px">"<c:out value="${concordance[i][j]}"/>"</span><br>
</c:otherwise>
</c:choose>
</c:forEach>
<br>
</c:forEach>
</div>
</c:if>
<c:if test="${not empty prettyOutput}">
<h3>Résultat Etude Controlée :</h3>
<table>
<tr>
<th>Concept</th>
<th>Concept supérieur</th>
<th>Concept(s) référent(s)</th>
<th>Concept(s) reliés</th>
<th>Valeur</th>
</tr>
<c:forEach items="${prettyOutput}" var="o">
<tr>
<td><c:out value="${o['node']}"/></td>
<td><c:out value="${o['broader']}"/></td>
<td><c:out value="${o['narrower']}"/></td>
<td><c:out value="${o['related']}"/></td>
<td><c:out value="${o['nRank']}"/></td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>
And the sevlet code :
package laetan.web.servlets;
import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import laetan.web.model.analyzer.TextAnalyzer;
import laetan.web.model.builder.FileLoader;
import laetan.web.model.builder.Vocabulary;
public class Analyzer extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
FileLoader.getThesaurii(request,true);
FileLoader.getModels(request,true);
this.getServletContext().getRequestDispatcher( "/WEB-INF/input.jsp" ).forward( request, response );
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
String f = request.getParameter("file");
Vocabulary vocabulary = new Vocabulary(request,"load");
#SuppressWarnings("unused")
TextAnalyzer analyze = new TextAnalyzer(request, vocabulary);
this.getServletContext().getRequestDispatcher( "/WEB-INF/input.jsp" ).forward( request, response );
}
}
In the servlet, f is null.

how to make entire grid view row clickable with asp.net 3.5

i 'm .net developer. i just want to know how to make grid view row clickable and if user clicks row then Grid View LinkButton with it's id click fired.
Is that possible with coding ??.
here is my grid view design:
<asp:GridView ID="GV_ViewReminder" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" CellPadding="4"
GridLines="None" Width="100%" onrowcommand="GV_ViewReminder_RowCommand"
DataKeyNames="Id" ondatabound="GV_ViewReminder_DataBound"
onpageindexchanging="GV_ViewReminder_PageIndexChanging"
onprerender="GV_ViewReminder_PreRender"
onrowdatabound="GV_ViewReminder_RowDataBound"
onsorting="GV_ViewReminder_Sorting">
<RowStyle CssClass="grid1" HorizontalAlign="Left" />
<Columns>
<asp:TemplateField>
<HeaderStyle CssClass="headinglist_bg" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Reminder Text" SortExpression="Reminder_Text">
<HeaderStyle CssClass="headinglist_bg" />
<ItemTemplate>
<asp:LinkButton ID="lbut_reminder" runat="server"
CommandArgument='<%# Eval("Id") %>' CommandName="View"
Text='<%# Eval("Reminder_Text").ToString().Length > 15 ? Eval("Reminder_Text").ToString().Substring(0,15)+"..." :Eval("Reminder_Text") %>'
Tooltip='<%# Bind("Reminder_Text") %>'></asp:LinkButton>
</ItemTemplate>
<HeaderTemplate>
<asp:LinkButton ID="lbut_sorttext" runat="server"
CommandArgument="Reminder_Text" CommandName="Sort" CssClass="normaltext"
Font-Bold="true" Text="Reminder Text"></asp:LinkButton>
<asp:PlaceHolder ID="placeholdertext" runat="server"></asp:PlaceHolder>
</HeaderTemplate>
<ItemStyle CssClass="quicklink" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Reminder Date" SortExpression="Reminder_Date">
<HeaderTemplate>
<asp:LinkButton ID="lbut_sortdate" runat="server"
CommandArgument="Reminder_Date" CommandName="Sort" CssClass="normaltext"
Font-Bold="true" Text="Reminder Date"></asp:LinkButton>
<asp:PlaceHolder ID="placeholderdate" runat="server"></asp:PlaceHolder>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Reminder_Date") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle CssClass="headinglist_bg" />
</asp:TemplateField>
</Columns>
<EmptyDataRowStyle BorderWidth="0px" Width="0px" />
<EmptyDataTemplate>
<asp:Label ID="Label2" runat="server" ForeColor="Red"
Text="No Records are found"></asp:Label>
</EmptyDataTemplate>
<PagerStyle CssClass="pager" HorizontalAlign="Center" VerticalAlign="Middle" />
<PagerTemplate>
<table>
<tr>
<td>
<asp:ImageButton ID="ImageButton1" runat="server"
AlternateText="Go to First Page" CommandArgument="First" CommandName="Page"
ImageUrl="../images/1330128819_resultset_first.png" />
</td>
<td>
<asp:ImageButton ID="ImageButton2" runat="server" AlternateText="Previous Page"
CommandArgument="Prev" CommandName="Page"
ImageUrl="../images/1330128981_resultset_previous.png" />
</td>
<td>
Page <asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="ddlPages_SelectedIndexChanged">
</asp:DropDownList>
of
<asp:Label ID="lblPageCount" runat="server"></asp:Label>
</td>
<td>
<asp:ImageButton ID="ImageButton3" runat="server" AlternateText="Next Page"
CommandArgument="Next" CommandName="Page"
ImageUrl="../images/Farm-Fresh_resultset_next.png" />
</td>
<td>
<asp:ImageButton ID="ImageButton4" runat="server"
AlternateText="Go to Last Page" CommandArgument="Last" CommandName="Page"
ImageUrl="../images/1330128876_resultset_last.png" />
</td>
</tr>
</table>
</PagerTemplate>
<FooterStyle CssClass="pager" VerticalAlign="Bottom" />
<HeaderStyle HorizontalAlign="Left" />
</asp:GridView>
i just want my LinkButton with id "lbut_reminder" get fired while user clicks entire row of grid view.
just add this script:
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$(".css-class").click(function () {
window.location = $(this).find("a").attr("href");
return false;
})
});
</script>

problem with .dll in aspx page

I have added an assembly to my project and then uses the assembly as follows:
<%# Page Title="" Language="C#" MasterPageFile="~/Global.Master" AutoEventWireup="true" CodeBehind="Calendar.aspx.cs" Inherits="Permias.Calendar" %>
<%# Register TagPrefix="ec" Namespace="ControlSample" Assembly="EventCalendar" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="content">
<div class="post">
<ec:EventCalendar runat="server" ID="eventscalendar" DataSourceID="sqldatasource1"
BorderWidth="0" DayField="starttime" ShowTitle="true" CssClass="eventmonthtable">
<DayHeaderStyle CssClass="caldays" />
<DayStyle CssClass="calcurrentmonth" />
<TodayDayStyle CssClass="calcurrentday" />
<WeekendDayStyle CssClass="calweekend" />
<OtherMonthDayStyle CssClass="calothermonth" />
<DayNumberStyle CssClass="dayNumber" />
<HeaderTemplate>
<table width="100%">
<tr align="center">
<td>
<asp:LinkButton ID="PrevMonth" runat="server" Text='<%# "« " + Container.PrevMonth.ToString("MMMM yyyy") %>'
CommandName="PrevMonth" />
</td>
<td>
<h3>
<asp:Label ID="label2" runat="server" Text='<%# Container.CurrentMonth.ToString("MMMM yyyy") %>' /></h3>
</td>
<td>
<asp:LinkButton ID="NextMonth" runat="server" Text='<%# Container.NextMonth.ToString("MMMM yyyy") + " »" %>'
CommandName="NextMonth" />
</td>
</tr>
</table>
<div class="dashedline">
</div>
</HeaderTemplate>
<DayEventTemplate>
<div style="padding: 3px;">
<asp:HyperLink ID="HyperLink1" runat="server" Text='<%#Eval("title") %>' NavigateUrl='<%# "Events_view.aspx?Eventid=" + Convert.ToString(Eval("ID"))%>'
ToolTip='<%# SharedRoutines.truncate((string)Eval("description")) %>' /></div>
</DayEventTemplate>
</ec:EventCalendar>
</div>
</div>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="splash" runat="server">
<div id="splash"> </div>
</asp:Content>
However it generates an error saying that:
Compiler Error Message: CS0103: The name 'SharedRoutines' does not exist in the current context
Why is this?
You need to include the namespace containing the SharedRoutines class at the top of the page, like this:
<%# Import Namespace="Your.Namespace" %>
You can also include it globally in Web.config:
<pages>
<namespaces>
<add namespace="Your.Namespace" />
</namespaces>
</pages>