﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - New Row Values are left aligned</title><link>http://www.intersoftsolutions.com/Community/WebGrid/New-Row-Values-are-left-aligned/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>New Row Values are left aligned</title><link>http://www.intersoftsolutions.com/Community/WebGrid/New-Row-Values-are-left-aligned/</link><pubDate>Thu, 13 May 2010 23:20:21 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;Unfortunately, WebGrid will not use the CellStyle text align property for the new row cell style. As a workaround, you will need to use the OnRowSelect client side event handler in order to apply the text align style for the new row. Here is the snippet:&lt;/p&gt;&lt;pre&gt;function OrderDetails_WebGrid_OnRowSelect(controlId, tblName, rowIndex, rowEl)&lt;br /&gt;{&lt;br /&gt;	var OrderDetails_WebGrid = ISGetObject(controlId);&lt;br /&gt;&lt;br /&gt;	if (rowEl.getAttribute("type") == "NewRow")&lt;br /&gt;	{&lt;br /&gt;	    var rowObj = OrderDetails_WebGrid.GetRowByElement(rowEl);&lt;br /&gt;	    var rightCell = ['Quantity_WebGridColumn', 'UnitPrice_WebGridColumn'];&lt;br /&gt;&lt;br /&gt;	    for (var i = 0; i &amp;lt; rightCell.length; i&amp;#43;&amp;#43;)&lt;br /&gt;	    {&lt;br /&gt;	        rowObj.GetCell(rightCell[i]).CellElement.style.textAlign = "right";&lt;br /&gt;	    }   &lt;br /&gt;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	return true;&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;</description></item><item><title>New Row Values are left aligned</title><link>http://www.intersoftsolutions.com/Community/WebGrid/New-Row-Values-are-left-aligned/</link><pubDate>Thu, 13 May 2010 10:51:38 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;I have a WebGrid with Server-Side Binding.&lt;/p&gt;
&lt;p&gt;I have inserted an example that uses the NorthWind Database.  You are going to have to change the Connection String.&lt;/p&gt;
&lt;p&gt;When clicking on the new row to activate it, the default values for the Quantity and Price Columns are displayed left aligned.  Even editing the Quantity and Price Columns, the values remain left aligned.&lt;/p&gt;
&lt;p&gt;For the existing rows, the Quantity and Price Columns are right aligned even during editing.&lt;/p&gt;
&lt;p&gt;How can I make the Quantity and Price Columns right aligned in the new row as they are in the existing rows?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Doug&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;%@ Page Language="C#" %&amp;gt;

&amp;lt;%@ Register assembly="ISNet.WebUI.WebCombo" namespace="ISNet.WebUI.WebCombo" tagprefix="ISWebCombo" %&amp;gt;
&amp;lt;%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %&amp;gt;
&amp;lt;%@ Register Assembly="ISNet.WebUI.WebInput" Namespace="ISNet.WebUI.WebControls" TagPrefix="ISWebInput" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;

&amp;lt;head runat="server"&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;script language="javascript" type="text/javascript"&amp;gt;
&amp;lt;/script&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;

	&amp;lt;asp:TextBox ID="CustomerID_TextBox" runat="server" Visible="false" Text="ALFKI"/&amp;gt;
	&amp;lt;asp:TextBox ID="OrderID_TextBox" runat="server" Visible="false" Text="10643"/&amp;gt;

	&amp;lt;br /&amp;gt;

		&amp;lt;ISWebGrid:WebGrid
			ID="OrderDetails_WebGrid"
			runat="server"
			DataSourceID="OrderDetails_SqlDataSource"
			DefaultStyleMode="Win7"
			Height="300px"
			UseDefaultStyle="True"
			Width="620px"
		&amp;gt;
			&amp;lt;LayoutSettings
				AllowAddNew="Yes"
				AllowDelete="Yes"
				AllowEdit="Yes"
				AllowSorting="Yes"
			&amp;gt;
			&amp;lt;/LayoutSettings&amp;gt;
			&amp;lt;RootTable
				DataKeyField="OrderID"
			&amp;gt;
				&amp;lt;Columns&amp;gt;
					&amp;lt;ISWebGrid:WebGridColumn
						Name="ProductID_WebGridColumn"
						Bound="True"
						DataMember="ProductID"
						Caption="Product Number"
						Width="130px"
					&amp;gt;
						&amp;lt;ValueList
							DataTextField="ProductID"
							DataValueField="ProductID"
						&amp;gt;
						&amp;lt;/ValueList&amp;gt;
						&amp;lt;HeaderStyle
							Font-Bold="true"
							HorizontalAlign="Center"
						/&amp;gt;
					&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
					&amp;lt;ISWebGrid:WebGridColumn
						Name="ProductName_WebGridColumn"
						Bound="False"
						DataMember="ProductName"
						Caption="Product Name"
						Width="300px"
					&amp;gt;
						&amp;lt;HeaderStyle
							Font-Bold="true"
							HorizontalAlign="Center"
						/&amp;gt;
					&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
					&amp;lt;ISWebGrid:WebGridColumn
						Name="Quantity_WebGridColumn"
						Bound="True"
						DataMember="Quantity"
						DataType="System.Decimal"
						CustomEditorName="WebInputNET"
						Caption="Quantity"
						Width="70px"
						DataFormatString="#,###"
						DefaultValue="1"
					&amp;gt;
						&amp;lt;CellStyle
							HorizontalAlign="Right"
						/&amp;gt;
						&amp;lt;HeaderStyle
							Font-Bold="true"
							HorizontalAlign="Right"
						/&amp;gt;
					&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
					&amp;lt;ISWebGrid:WebGridColumn
						Name="UnitPrice_WebGridColumn"
						Bound="True"
						DataMember="UnitPrice"
						DataType="System.Decimal"
						Caption="Price"
						Width="80px"
						DataFormatString="$#,###.00"
						DefaultValue="45"
					&amp;gt;
						&amp;lt;CellStyle
							HorizontalAlign="Right"
						/&amp;gt;
						&amp;lt;HeaderStyle
							Font-Bold="true"
							HorizontalAlign="Right"
						/&amp;gt;
					&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
				&amp;lt;/Columns&amp;gt;
			&amp;lt;/RootTable&amp;gt;
		&amp;lt;/ISWebGrid:WebGrid&amp;gt;

		&amp;lt;asp:SqlDataSource
			ID="OrderDetails_SqlDataSource"
			runat="server"
			ConnectionString="&amp;lt;%$ ConnectionStrings:NorthwindConnectionString2005 %&amp;gt;"
			SelectCommand="
					SELECT
						*
					FROM
						[Order Details]
					WHERE
						[OrderID]	= @OrderID
					ORDER BY
						[OrderID]
					"
		&amp;gt;
			&amp;lt;SelectParameters&amp;gt;
				&amp;lt;asp:ControlParameter
					Name="OrderID"
					ControlID="OrderID_TextBox"
					PropertyName="Text"
					DefaultValue=""
				/&amp;gt;
			&amp;lt;/SelectParameters&amp;gt;
		&amp;lt;/asp:SqlDataSource&amp;gt;

    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;</description></item></channel></rss>