Gridview in asp.net mvc2 - asp.net-mvc

I need to use ASP.Net gridview and do operations like sorting paging and selecting checkboxes in my asp.net mvc content view. I dont what to do. I've written something like this:
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table runat="server" id="tbldealData" style="width: auto; height: auto">
<tr>
<td>
<cc1:ExtendedGridView ID="ExtendedGridView1" runat="server" AutoGenerateColumns="false"
AllowFiltering="true">
<Columns>
<asp:TemplateField HeaderText="Wait For Payment From SAP">
<EditItemTemplate>
<asp:CheckBox ID="chkWaitForSAP" runat="server" />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkWaitForSAP" Checked="true" AutoPostBack="true"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Deal Number" SortExpression="DealNumber">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%= Html.LabelFor(model => model.DealNumber) %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%= Html.LabelFor(model => model.DealNumber) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cost Number" SortExpression="CostNumber">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server" Text='<%= Html.LabelFor(model => model.CostNumber) %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%= Html.LabelFor(model => model.CostNumber) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Source System" SortExpression="SourceSystemName">
<EditItemTemplate>
<asp:TextBox ID="TextBox6" runat="server" Text='<%= Html.LabelFor(model => model.SourceSystemName) %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%= Html.LabelFor(model => model.SourceSystemName) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="CounterParty" SortExpression="CounterpartyName">
<EditItemTemplate>
<asp:TextBox ID="TextBox7" runat="server" Text='<%= Html.LabelFor(model => model.CounterpartyName) %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%= Html.LabelFor(model => model.CounterpartyName) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<AlternatingRowStyle BackColor="#E5E5E5" />
<PagerStyle ForeColor="Blue" />
<PagerTemplate>
<asp:LinkButton CommandName="Page" CommandArgument="First" ID="LinkButton1" runat="server"
Style="color: Blue">
« First</asp:LinkButton>
<asp:LinkButton CommandName="Page" CommandArgument="Prev" ID="LinkButton2" runat="server"
Style="color: Blue"> < Prev</asp:LinkButton>
[<%= ExtendedGridView1.PageIndex * ExtendedGridView1.PageSize%>-<%= ExtendedGridView1.PageIndex * ExtendedGridView1.PageSize + ExtendedGridView1.PageSize - 1%>]
<asp:LinkButton CommandName="Page" CommandArgument="Next" ID="LinkButton3" runat="server"
Style="color: Blue">
Next ></asp:LinkButton>
<asp:LinkButton CommandName="Page" CommandArgument="Last" ID="LinkButton4" runat="server"
Style="color: Blue">
Last »</asp:LinkButton>
</PagerTemplate>
</cc1:ExtendedGridView>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Save" />
<input type="reset" value="Cancel" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
but it is not shwoing me any thing in my rendered view. Am blank now. Please help

Although you can, I don' recommend using web controls in MVC. I would recommend utilizing a client side grid, or creating a HTML helper that achieves similar functionality.
If you want a FREE, elegant, and easy to implement grid for MVC you can check out Telerik. There grid is world class, IMO.

If you're not adversed to downloading ASP.NET MVC 3 Beta, there is a new control/helper called WebGrid which will do exactly what you want.
Writeup/usage on it here.

If you want something very powerful and even lightweight give a look to the grid Helper contained in the MVCContrib project at codeplex
Here you will find some good blog post on the argument
ASP.NET MVC Paging/Sorting/Filtering using the MVCContrib Grid and Pager
Looking for an MVC Grid Control? Try MVC Contrib!
Use MVCContrib grid for editing
Walkthrough: full example of using MvcContrib grid with jQuery datatable

Related

The page is validated automatically after I set a validator and every time I want to redirect to another page, I get the error from validator?

I though I have finished working on the page, however, after another round of checking, it seems that the previous working link is not working anymore and every time when clicked, tries to validate the page.
The link is a part of a main master page.
Looks like the Post Back event called from the clicking on the link is trying to validate Date Pickers again.
I have the following logic to build CustomValidator and RadGrid, where I validates RadDatePickers:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<div align="center">
<asp:CustomValidator ID="checkForTwoDates" ClientValidationFunction="AtLeastOneDate_ClientValidate" ViewStateMode="Enabled"
EnableClientScript="True" ErrorMessage="At least one date should be selected" runat="server"></asp:CustomValidator>
<table class="moss2Search">
<tr>
<td>
<div runat="server">
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker1" width="100%" runat="server" DateInput-Label="Boarding Start Date"></telerik:RadDatePicker>
</div>
</td>
<td>
<div runat="server">
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker2" width="100%" runat="server" DateInput-Label="Boarding End Date">
</telerik:RadDatePicker>
</div>
</td>
<td>
<div>
<asp:CheckBox ID="chkMerActive" runat="server" Checked="true"/>Active
</div>
</td>
<td>
<telerik:RadButton RenderMode="Lightweight" runat="server" Text="Search" ID="Button1" OnClick="btnSearch_Click"></telerik:RadButton>
</td>
</tr>
</table>
</div>
</telerik:RadAjaxPanel>
<asp:Label ID="lblMsg" ForeColor="red" runat="server"></asp:Label>
<br />
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="ajaxControl">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ajaxUpdateControl"></telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<div>
<telerik:RadGrid RenderMode="Lightweight" runat="server" ID="grdMoss2Merchants" AllowPaging="True" AllowSorting="true" PagerStyle-AlwaysVisible="true" OnNeedDataSource="BindToDatasource">
<ExportSettings IgnorePaging="true">
<Excel WorksheetName="Moss2Merchants" />
</ExportSettings>
</telerik:RadGrid>
</div>
What am I doing wrong or missing?

Edit/delete items not work in GridView

I have a MVC ASP.NET project with GridView. "Enable Editing", "Enable Deleting" are installed, data columns convert into a TemplateField. SqlDataSource is connected. Table have a primary key. For SqlDataSource installed "Generate INSERT, UPDATE and DELETE statements". On click for “Edit” or “Delete” generates page reloading, but data cannot be edited or deleted.
<asp:GridView ID="GridView1" runat="server" DataKeyNames="Id" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" >
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:TemplateField HeaderText="Id" SortExpression="Id">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Caption" SortExpression="Caption">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Caption") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Caption") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Text" SortExpression="Text">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Text") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Text") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CheckBoxField HeaderText="ABC" DataField="Checked" />
</Columns>
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#FFF1D4" />
<SortedAscendingHeaderStyle BackColor="#B95C30" />
<SortedDescendingCellStyle BackColor="#F1E5CE" />
<SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>
You cannot1 use WebForms controls (namespaces System.Web.UI.WebControls and System.Web.UI.HtmlControls) with MVC's actions and controllers.
WebForms controls assume the page life cycle happening on the server: but this series of events (and associated code organisation) does not exist with MVC controllers and actions.
1 You will find examples where this has been done with varying levels of hacks. To with some degress of success but you will be fighting against the tide. You are better off switching paradigm fully: a page is either MVC or WebForms. Mixing is just saving pain for later.

ASP.NET, Images, UpdatePanel iOS

I have developed a Web App that displays a live view of an HMI process.
Essentially it consists of master-detail solution. Within one of the detail pages is an image that refreshes every second on a timer tick. The image is displayed within a panel, itself inside an UpdatePanel. The updatepanel is explicitly refreshed on a timer tick (btw I've tried all variations/combinations of updatepanel properties without success).
On desktop Chrome, IE, Firefox, this solution works well. Sometimes, for some unknown reason, the page insists on doing a full refresh but overall the animation is smooth. Below is a screenshot of what the page looks like
When this app is viewed in Safari/Opera/Dolphin (build 5) (iOS 5 and 7), the results are very different. In between refreshes, the page is rendered minus the image and then finally with the image. The result is horrible shuddering of the page. The page in fact appears to be doing a full refresh (even the nav bar at the top resizes). The below image is what appears in between the update of the main image:
And when it's sorted itself out, the full page:
Occasionally this behaviour occurs on Chrome/Firefox on the desktop versions - this was minimised by disabling hardware acceleration within the browsers. But for Safari, it happens every refresh and has become a serious, app-killer problem since the majority of intended users will be iPad/iPhone users.
I've searched for days for a solution, adding various things to web.config, Page PreInit etc, but with no luck.
This is some of what I've tried :
Web.Config
<browserCaps userAgentCacheKeyLength="256" />
Source Code:
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request.UserAgent != null && Request.UserAgent.IndexOf("AppleWebKit", StringComparison.CurrentCultureIgnoreCase) > -1)
{
this.ClientTarget = "uplevel";
}
I've done some playing around with how the image is inserted into the page ( it's a Base64 jpg string). I thought there was a problem with the image, but cutting a long story short, I inserted instead a tiny standard project image (.jpg) with the url suffixed with a random number to prevent caching - and the problem still happened (i.e. a full refresh still occurred in between timer ticks). So it's not an issue with the base64 encoded string. I've also removed all other controls apart from the image and still I get the full page refresh and violent screen shudder.
This is driving me nuts. I've tried it on iOS5 and 7 and both have the same refresh problem. It's really quite serious, since this makes the app unusable on iPads/iPhones.
I hope someone can please help.
Thanks
Here's the aspx code of the Master Page:
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="PracticonWebMimic.SiteMaster" %>
<!DOCTYPE html>
<html lang="en">
<head runat="server">
<%-- <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">--%>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%: Page.Title %> - Practicon Factory Viewer</title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:bundlereference runat="server" path="~/Content/css" />
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta http-equiv=”Page-Exit” content=”progid:DXImageTransform.Microsoft.Fade(duration=.5)” />
</head>
<body>
<form runat="server">
<asp:ScriptManager runat="server" EnablePartialRendering="true">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
<%--Framework Scripts--%>
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="bootstrap" />
<asp:ScriptReference Name="respond" />
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Path="~/Scripts/webkit.js" />
<%--Site Scripts--%>
</Scripts>
</asp:ScriptManager>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" runat="server" href="~/">Practicon Factory View</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a runat="server" href="~/">Home</a></li>
<li><a runat="server" id="mimicList" visible="false"
href="~/RestrictedAccess/MimicList.aspx">Views</a></li>
<li><a runat="server" id="mimicListArchive" visible="false"
href="~/RestrictedAccess/MimicList.aspx?archive=<%= DateTime.Now.Ticks %>">Archive Views</a></li>
<!-- <li><a runat="server" href="~/About">About</a></li>
<li><a runat="server" href="~/Contact">Contact</a></li> -->
</ul>
<asp:LoginView runat="server" ViewStateMode="Disabled">
<AnonymousTemplate>
<ul class="nav navbar-nav navbar-right">
<!-- <li><a runat="server" href="~/Account/Register">Register</a></li> -->
<li><a runat="server" href="~/Account/Login">Log in</a></li>
</ul>
</AnonymousTemplate>
<LoggedInTemplate>
<ul class="nav navbar-nav navbar-right">
<li>
<asp:LoginStatus runat="server" LogoutAction="Redirect" LogoutText="Log off" LogoutPageUrl="~/" OnLoggingOut="Unnamed_LoggingOut" />
</li>
</ul>
</LoggedInTemplate>
</asp:LoginView>
</div>
</div>
</div>
<div class="container body-content">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
<hr />
<p >Tip: For optimal viewing experience, please ensure you have <b>disabled</b> <i>Hardware Acceleration</i> in your browser's settings. Google Chrome is the recommended browser.</p>
<hr />
<footer>
<p>© <%: DateTime.Now.Year %> - Practicon Factory <i>View</i></p>
<asp:Label id="lbError" runat="server" Text=""></asp:Label>
</footer>
</div>
</form>
</body>
</html>
and the code for the detail page
<%# Page Title="Factory View" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MimicDetails.aspx.cs" Inherits="PracticonWebMimic.MimicDetails" %>
<%# Register Assembly="TimePicker" Namespace="MKB.TimePicker" TagPrefix="MKB" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<link href="/Content/PrBlueTable.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script src="//cdn.jsdelivr.net/jquery.ui.timepicker.addon/1.4.5/jquery-ui-sliderAccess.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/jquery.ui.timepicker.addon/1.4.5/jquery-ui-timepicker-addon.css">
<script src="//cdn.jsdelivr.net/jquery.ui.timepicker.addon/1.4.5/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
});
function InitializeRequest(sender, args) { }
function EndRequest(sender, args) {
// after update occur on UpdatePanel re-init the DatePicker
$('.ui-datepicker').datetimepicker({
inline: true,
showOtherMonths: true,
showOn: 'focus',
showButtonPanel : true,
dateFormat: "dd/mm/yy",
nextText: ">>",
prevText : "<<",
timeFormat: "HH:mm:ss",
dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
});
}
</script>
<script type="text/javascript" >
if (typeof (Sys.Browser.WebKit) == "undefined") {
Sys.Browser.WebKit = {};
}
if (navigator.userAgent.indexOf("WebKit/") > -1) {
Sys.Browser.agent = Sys.Browser.WebKit;
Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
Sys.Browser.name = "WebKit";
}
</script>
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(beginRequest);
function beginRequest() {
prm._scrollPosition = null;
}
</script>
<asp:FormView ID="mimicDetail" runat="server"
ItemType="PracticonWebMimic.Models.Mimic" SelectMethod ="GetMimic"
RenderOuterTable="false">
<ItemTemplate>
<div>
<h2>
<asp:Label ID="lblActive_MimicDetails" runat="server" Visible="true"/>
<%#:Item.MimicName %>
</h2>
</div>
<br />
<table>
<tr>
<td>
<asp:UpdatePanel ID="upMimic_MimicDetails" runat="server" UpdateMode="Conditional" ChildrenAsTrigger="false">
<Triggers>
<%-- <asp:AsyncPostBackTrigger ControlID="tmrMimic_MimicDetails" EventName="Tick"/> --%>
</Triggers>
<ContentTemplate>
<asp:Label ID="lbConditionName_MimicDetails" runat="server" CssClass="btn-primary" Visible="False"/>
<asp:Panel ID="pnMimic" runat="server" style="margin-bottom: 2px">
<asp:image id="imMimic_MimicDetails" runat="server" />
<h4><asp:Label id="lbDirection_MimicDetails" runat="server" CssClass="btn-default" Text=""></asp:Label> </h4>
<%-- Action Buttons starts here ------------------------------------------------------------------------------------------------------------------------------- --%>
<asp:Table class="tbActionButtonBar" runat="server" CssClass="prTable">
<asp:TableRow >
<asp:TableCell>
<asp:Table class="tbActionButtonBar" runat="server">
<asp:TableRow >
<asp:TableCell >
<asp:ImageButton id="btnRestart_MimicDetails" runat="server" onclick="imgRestart_Click" Width="50" ToolTip="Restart playback from beginning." />
<asp:ImageButton id="btnStop_MimicDetails" runat="server" onclick="imgStop_Click" Width="50" ToolTip="Stop playback and show the LIVE Factory View." />
<asp:ImageButton id="btnRewind_MimicDetails" runat="server" onclick="imgRewind_Click" Width="50" ToolTip="Rewind the animation" />
<asp:ImageButton id="btnPlay_MimicDetails" runat="server" onclick="imgPlay_Click" Width="50" ToolTip="Start playback of animation from current time." />
<asp:ImageButton id="btnFForward_MimicDetails" runat="server" onclick="imgFForward_Click" Width="50" ToolTip="Fast-forward through animation." />
<asp:ImageButton id="btnPause_MimicDetails" runat="server" onclick="imgPause_Click" Width="50" ToolTip="Pause playback of animation." />
</asp:TableCell>
<asp:TableCell>
<asp:ImageButton id="btnTrends_MimicDetails" runat="server" Width="50" ToolTip="Show the Trends for the current Factory View" />
</asp:TableCell>
<asp:TableCell>
<asp:ImageButton id="btnConditionMonitoring_MimicDetails" runat="server" Width="50" ToolTip="View Condition Monitoring for this Factory View." />
</asp:TableCell>
<asp:TableCell>
<h5><asp:Label ID="lbStatus_MimicDetails" runat="server" CssClass="btn-default" Text=""></asp:Label></h5>
</asp:TableCell>
<asp:TableCell>
<h5><asp:Label ID="lbSession_MimicDetails" runat="server" CssClass="btn-default" Text=""></asp:Label></h5>
</asp:TableCell>
<asp:TableCell>
<asp:Button ID="btnSession_MimicDetails" runat="server" Text="RESET" CssClass="btn btn-default" onclick="btnSession_MimicDetails_Click"> </asp:button>
</asp:TableCell >
</asp:TableRow>
</asp:Table>
</asp:TableCell >
</asp:TableRow>
</asp:Table>
<%-- DateTime control starts here ------------------------------------------------------------------------------------------------------------------------------- --%>
<asp:Table id="tbActionDateBar_MimicDetails" runat="server" CssClass="prBlueTable">
<asp:TableRow>
<asp:TableCell >
<asp:Label Text="FROM : " runat="server" id="lbFrom_MimicDetails"></asp:Label>
<asp:TextBox type="text" id="txtStartDate_MimicDetails" runat="server" OnTextChanged="txtStartDate_MimicDetails_TextChanged" />
<asp:Label id="lbFromDate_MimicDetails" runat="server"/>
</asp:TableCell><asp:TableCell>
<asp:CheckBox Text=" End date? " runat="server" id="chkEndDate_MimicDetails" AutoPostBack="true" OnCheckedChanged="chkEnableEndDate_CheckedChanged"></asp:CheckBox>
</asp:TableCell><asp:TableCell >
<asp:Label Text="TO : " runat="server" ID ="lbTo_MimicDetails"></asp:Label>
</asp:TableCell><asp:TableCell>
<asp:TextBox type="text" id="txtEndDate_MimicDetails" runat="server" OnTextChanged="txtEndDate_MimicDetails_TextChanged"/>
<asp:Label id="lbEndDate_MimicDetails" runat="server"/>
</asp:TableCell><asp:TableCell>
<asp:CheckBox Text="Auto-restart?" runat="server" id="chkAutoRewind_MimicDetails" OnCheckedChanged="chkAutorewind_MimicDetails_CheckedChanged"></asp:CheckBox>
</asp:TableCell></asp:TableRow></asp:Table><asp:Timer ID="tmrMimic_MimicDetails" runat="server" Interval="1000" OnTick="MimicTimer_Tick" ClientIDMode="AutoID"> </asp:Timer>
<asp:Label ID="lbServiceResponse_MimicDetails" runat="server" CssClass="btn-default" Text="" ></asp:Label><br /><asp:Label id="lbRefreshRequested_MimicDetails" runat="server" Text=""></asp:Label>
<asp:Label id="lbRefreshed_MimicDetails" runat="server" Text=""></asp:Label>
<br /><asp:Label ID="lbServiceAddress_MimicDetails" runat="server" Text=""></asp:Label><br/>
<asp:Label ID="lbError_MimicDetails" runat="server" Text=""></asp:Label>
<asp:Label ID="lbSessionID_MimicDetails" runat="server" Text=""></asp:Label>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</ItemTemplate>
</asp:FormView>
</asp:Content>

JQuery Mobile <ul> not expanding in full browser

Using a basic <ul> and <li> within asp.net project with input controls, can't figure out why <ul> will not expand to full browser width? The <ul> will expand with wider <li> content.
<ul data-role="listview" id="ul-edit-picks" data-divider-theme="a" data-inset="true" data-scroll="true">
<li data-role="list-divider">
<h2 id="itemTitle">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("FDID")%>' Font-Bold="True" Font-Size="Medium"></asp:Label>
: Selections</h2>
</li>
<li>1st Week:
<asp:TextBox ID="CHOICE1TextBox" runat="server" Text='1st Week' ReadOnly="True"></asp:TextBox><br />
<asp:HiddenField ID="CHOICE1HiddenField" runat="server" Value='<%# Bind("CHOICE1")%>' />
</li>
<li>2nd Week:
<asp:TextBox ID="CHOICE2TextBox" runat="server" Text='' ReadOnly="True"></asp:TextBox><br />
<asp:HiddenField ID="CHOICE2HiddenField" runat="server" Value='<%# Bind("CHOICE2")%>' />
</li>
...
<li>
<asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Update Selections" ToolTip="Click to change your selections..."></asp:Button>
<asp:Button ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:Button>
</li>
</ul>
Screen Shots:
Try with data-inset="false" on < ul >
ok the problem was in the <FormView> of the .net section of my page, see: asp.net formview generates table at fixed width 259px
it's seems the default width of 259px is auto generated in the form based on content size.

Basic Grails question: How does the following Grails code define personInstance?

This is the GSP code generated by Grails for the view of the edit action for a Person domain object which is part of my model, and also happens to be the primary class for authentication by the ACEGI security plug-in. I have snipped out a bunch of properties to keep it short. The file resides in the standard location, grails-app/views/person/edit.gsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="main" />
<g:set var="entityName" value="${message(code: 'person.label', default: 'Person')}" />
<title><g:message code="default.edit.label" args="[entityName]" /></title>
</head>
<body>
<div class="nav">
<span class="menuButton"><a class="home" href="${createLink(uri: '/')}">Home</a></span>
<span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
<span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
</div>
<div class="body">
<h1><g:message code="default.edit.label" args="[entityName]" /></h1>
<g:if test="${flash.message}">
<div class="message">${flash.message}</div>
</g:if>
<g:hasErrors bean="${personInstance}">
<div class="errors">
<g:renderErrors bean="${personInstance}" as="list" />
</div>
</g:hasErrors>
<g:form method="post" >
<g:hiddenField name="id" value="${personInstance?.id}" />
<g:hiddenField name="version" value="${personInstance?.version}" />
<div class="dialog">
<table>
<tbody>
<tr class="prop">
<td valign="top" class="name">
<label for="username"><g:message code="person.username.label" default="Username" /></label>
</td>
<td valign="top" class="value ${hasErrors(bean: personInstance, field: 'username', 'errors')}">
<g:textField name="username" value="${personInstance?.username}" />
</td>
</tr>
...SNIP...
a bunch of props
</tbody>
</table>
</div>
<div class="buttons">
<span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
<span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
</div>
</g:form>
</div>
</body>
</html>
My question is, how does the field personInstance get set up and populated?
I suspect this is a basic question which belies a fundamental lack of understanding on my part about how Grails works, but I need to know nonetheless.
This stems from the desire to create my own composite pages which access a Person object and its associated data, which is the heart of my app. I was expecting to be able to create a new page alongside this one, let's call it map.gsp, and get at the personInstance in some magic way. I can't figure out how to do that in spite of trying the obvious, and I think I have a gap right at the centre of my understanding.
PersonInstance will be populated on the controller.
When you submit your form, the associated controller will receive a map containing the fields present on your form.
So, in your controller you'll find a command like
personInstance.properties = params
where params is a map containing the fields submited for the controller, which the keys are the names of the input elements you defined on your gsp file.

Resources