how to make entire grid view row clickable with asp.net 3.5 - 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>

Related

Selecting a single row in component art grid not working

I have Question about component art grid.
Have anyone struggled with the selecting of a single row where your attribite is AllowMultipleSelect="false" but you are still able to select Multiple rows.
I just can't seem to get around this because I only want the selected row highlighted with what ever color the selectedRowCssClass color is.
Here is my front end code:
<%# Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<base target="_self" />
<title>iView Trend Data</title>
<link href="Assets/OldCss/gridStyle.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<asp:HiddenField ID="ParamA" runat="server" />
<asp:HiddenField ID="ParamB" runat="server" />
<table style="width:100%; Height:100%;" >
<tr>
<td>
<ComponentArt:CallBack id="CallBack1" CacheContent="false" width="100%" Height="100%" runat="server">
<Content>
<ComponentArt:Grid ID="Grid1"
CssClass="Grid"
runat="server"
RunningMode="Client"
ShowFooter="false"
ImagesBaseUrl="~/Assets/Image/Grid/"
Sort="DateTime"
ScrollBar="Auto"
ScrollTopBottomImagesEnabled="true"
ScrollTopBottomImageHeight="2"
ScrollTopBottomImageWidth="16"
ScrollImagesFolderUrl="~/Assets/Image/Grid/"
ScrollButtonWidth="16"
ScrollButtonHeight="17"
ScrollBarCssClass="ScrollBar"
ScrollGripCssClass="ScrollGrip"
ScrollBarWidth="16"
ScrollPopupClientTemplateId="ScrollPopupTemplate"
Width="760"
Height="618"
AllowTextSelection="false"
AllowHorizontalScrolling="True"
AllowMultipleSelect="false"
PageSize="30"
ShowHeader="true"
ShowSearchBox="true"
SearchOnKeyPress="true"
Visible="true"
AllowVerticalScrolling="False"
GroupingNotificationText="">
<Levels>
<ComponentArt:GridLevel
DataKeyField="DateTime"
ShowTableHeading="False"
ShowSelectorCells="False"
HeadingCellCssClass="HeadingCell"
HeadingCellHoverCssClass="HeadingCellHover"
HeadingCellActiveCssClass="HeadingCellActive"
HeadingTextCssClass="HeadingCellText"
DataCellCssClass="DataCell"
RowCssClass="DataRow"
SelectedRowCssClass="SelectedRow"
SortAscendingImageUrl="asc.gif"
SortDescendingImageUrl="desc.gif"
ColumnReorderIndicatorImageUrl="reorder.gif"
SortedDataCellCssClass="SortedDataCell"
SortImageWidth="14"
SortImageHeight="14"
AllowGrouping="false"
AlternatingRowCssClass="AlternatingRow">
<Columns>
<ComponentArt:GridColumn DataField="DateTime" Width="100" FormatString="yyyy-MM-dd HH:mm" Visible="false"/>
</Columns>
</ComponentArt:GridLevel>
</Levels>
<clienttemplates>
<ComponentArt:ClientTemplate Id="ScrollPopupTemplate">
<table cellspacing="0" cellpadding="2"
border="0" class="ScrollPopup">
<tr>
<td style="width:50px;">
<div style="font-size:10px;font-family:MS Sans Serif; text-overflow:ellipsis; overflow:visible;">
<nobr>## DataItem.GetMember("DateTime").Text ##</nobr>
</div>
</td>
</tr>
</table>
</ComponentArt:ClientTemplate>
</clienttemplates>
</ComponentArt:Grid>
</Content>
<LoadingPanelClientTemplate>
<table width="100%" align="center" style="position:relative;top:250px">
<tr>
<td style="color:#cee820" align="right">Loading..</td>
<td align="left"> <img src="./images/ajax-loader.gif" width="48" height="48" border="0"/></td>
</tr>
</table>
</LoadingPanelClientTemplate>
</ComponentArt:CallBack>
</td>
</tr>
</table>
</form>
</body>
</html>
I had a similar problem, which turned out to be because values of the DataKeyField had spaces in them.

Accordion inside another accordion

Iam using ajax accordion. Is it possible to add an ajax accordion inside another accordion.
I tried adding this, but the accordion inside is not loading(not getting displayed)
<ajax:Accordion ID="accordionCountry" HeaderCssClass="headerStyle marginUpDown" HeaderSelectedCssClass="headerSelectedStyle" ContentCssClass="contentBackground" runat="server" SelectedIndex="-1" FadeTransitions="true" SuppressHeaderPostbacks="true" TransitionDuration="250" FramesPerSecond="40" RequireOpenedPane="false" AutoSize="None">
<HeaderTemplate>
<asp:Panel ID="pnlShowCategory" runat="server" CssClass="cursorPointer categoryPanelBackground marginUpDown">
<table cellpadding="0" cellspacing="0" width="98%">
<tr>
<td align="left">
<asp:Label ID="lblCategoryName" runat="server" Text='<%# Eval("CategoryName") %>'
CssClass="paddingLeft"></asp:Label>
</td>
<td align="right">
<asp:Image ID="Image3" runat="server" ImageAlign="Right" Height="20px" CssClass="verticalAlignMiddle" />
<asp:HiddenField ID="hdnCategoryId" runat="server" Value='<%# Eval("CategoryId") %>' />
</td>
</tr>
</table>
</asp:Panel>
</HeaderTemplate>
<ContentTemplate>
<ajax:Accordion ID="accordionCountry1" HeaderCssClass="headerStyle marginUpDown" HeaderSelectedCssClass="headerSelectedStyle"
ContentCssClass="contentBackground" runat="server" SelectedIndex="-1" FadeTransitions="true"
SuppressHeaderPostbacks="true" TransitionDuration="250" FramesPerSecond="40"
RequireOpenedPane="false" AutoSize="None">
<HeaderTemplate>
</HeaderTemplate>
<ContentTemplate>
<asp:Panel ID="pnl" runat="server" CssClass="cursorPointer categoryPanelBackground marginUpDown">
<table cellpadding="0" cellspacing="0" width="98%">
<tr>
<td align="left">
<asp:Label ID="lblSubCategoryName" runat="server" Text='<%# Eval("SubCategoryName") %>'
CssClass="paddingLeft"></asp:Label>
</td>
<td align="right">
<asp:Image ID="Image3" runat="server" ImageAlign="Right" Height="20px" CssClass="verticalAlignMiddle" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</ajax:Accordion>
</ContentTemplate>
</ajax:Accordion>
try to use jQuery for accordion, it's better, check below link out :
click run after you click the link below
(function($) {
var allPanels = $('.accordion .dd').hide();
$('.accordion .dt a').click(function() {
allPanels.slideUp();
$(this).parent().next().slideDown();
return false;
});
})(jQuery);
Check This

overlapping of panels (ascx) in IE7

I have the problem of panel overlapping in IE7 whereas the same code works in IE8.
Has anyone faced this kind of problem?
In the code below, i have a link button, on clicking this, the products frame would be displayed. But this overlaps with the "client products" :
<%# Control Language="C#" AutoEventWireup="true" CodeFile="ClientSummary.ascx.cs" Inherits="ClientSummary" %>
<%# Register Src="~/Controls/ClientSession/CounselorMenuFrame.ascx" TagName="CounselorMenuFrame" TagPrefix="UCC" %>
<%# Register Src="~/Controls/ClientSession/ProductsFrame.ascx" TagName="ProductsFrame" TagPrefix="UCC" %>
<%# Register Src="~/Controls/ClientSession/ProductDetailFrame.ascx" TagName="ProductDetailFrame" TagPrefix="UCC" %>
<%# Register Src="~/Controls/ClientSession/ClientDetailFrame.ascx" TagName="ClientDetailFrame" TagPrefix="UCC" %>
<asp:Panel ID="pnlClntSummary" runat="server" EnableViewState="true" >
<asp:Panel ID="pnlClientDetailFrame" runat="server" Style="width: 950px;" >
<UCC:ClientDetailFrame id="clientDetailFrame" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlProductDetailFrame" runat="server" Style="width: 950px;" >
<UCC:ProductDetailFrame id="productDetailFrame" runat="server"/>
</asp:Panel>
<div id="slider" style="width:950px;">
asp:Panel ID="pnlProductsFrame" runat="server" Style="width: 950px;" >
<table style="width:900px;" >
<tr><td></td><td>
<asp:LinkButton Text="Client Information" ID="clientDetail" Font-Underline="true"
Font-Bold="true" Font-Names="Calibri" Font-Size="Medium" runat="server"
onclick="clientDetail_Click"/>
</td>
</tr>
<tr>
<td valign="top" style="float:left" align="left">
<div style="float:left;vertical-align:top;">
<div id="content" class="contentMenu">
<UCC:ProductsFrame id="productsFrame" runat="server" />
</div>
</div>
</td>
<td valign="top" style="width:900px;" align="left">
<div id="header1" style="float:left;position:relative;width:45px;">
<table border="0">
<tr>
<td valign="top" style="width:30px;"
onclick="verticalprocessClick(document.getElementById('header1'))">
<div style="padding: 2px; cursor: pointer; vertical-align: top;">
<div style="float: left; vertical-align: bottom;">
<table>
<tr onclick="ImageChangePFrame(imgPF)">
<td class="VerticalLine">
</td>
<td>
<img id="imgPF" src="../Images/icon_expand.png" alt="(Show Details...)"
onload="ProductFrameHide(this)"/>
<div id="divClientProducts" runat="server"
style="float:left;font-family:Calibri;top:1%;left:25%;position:relative;font-size:13px;
color:Gray;text-align:center;">
C<br />
L<br />
I<br />
E<br />
N<br />
T<br />
<br />
P<br />
R<br />
O<br />
D<br />
U<br />
C<br />
T<br />
S<br />
</div>
</td>
<td class="VerticalLine">
</td>
</tr>
</table>
</div>
</div>
</td>
<td>
</td>
</tr>
</table>
</div>
<div id="divTransactionDesktop" style="float:left;width:600px; height:100px;" >
<asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<asp:PlaceHolder ID="MainFrameHolder" runat="server"></asp:PlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
<asp:HiddenField ID="hdnRowValue" runat ="server" Value="0" />
</div>
</td>
</tr>
</table>
</asp:Panel>
</div>
<asp:HiddenField ID="hdnLastFocus" runat="server" />
<asp:HiddenField ID="hdnKeyMapping" runat="server" />
</asp:Panel>
I found a solution for overlapping of panels in IE7. It was the height attribute which made a difference. Removing the height attribute or mentioning the exact value in pixels, solves this problem.

How to implement EntityDataSource Where IN entity sql clause

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

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>