my TemplateColumn In RadGrid (Telerik) is like below :
<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Benefit"
HeaderText="Benefit" UniqueName="TemplateColumn_Benefit" FilterImageToolTip="Filter">
<ItemTemplate>
<asp:Label ID="lblBenefitInsideGrd" runat="server" Font-Size="11px" Text='<%# (bool)Convert.IsDBNull(Eval("Benefit")) ? "<span class=\"lblInsideGrd\">Empty</span>" : String.Format("{0:#,0 Dollar;#,0- Dollar}", Eval("Benefit")) %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
</telerik:GridTemplateColumn>
the showfooter property of RadGrid Is true ...
when add the below properties to this template column , so we will have an exeption ...
properties : FooterText="my sum" Aggregate="Sum"
error message : Sum is not supported for type "System.Object"
how can i have sum of such these columns in radgrid ?
thanks in advance
You have to add the DataField="Benefit" to the GridTemplateColumn.
<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Benefit" DataField="Benefit"
HeaderText="Benefit" UniqueName="TemplateColumn_Benefit" FilterImageToolTip="Filter">
<ItemTemplate>
<asp:Label ID="lblBenefitInsideGrd" runat="server" Font-Size="11px" Text='<%# (bool)Convert.IsDBNull(Eval("Benefit")) ? "<span class=\"lblInsideGrd\">Empty</span>" : String.Format("{0:#,0 Dollar;#,0- Dollar}", Eval("Benefit")) %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
</telerik:GridTemplateColumn>
Related
hi i have a Gridview that load from the database and i create a column in the Gridview name lblImportanceRatio and i need this column to generate those number in every row 25,20,35,20
this is the Gridview:
enter image description here
and the column name SymbolicRate i wanna just generate those number 25,20,35,20 in every row i tried to add the generate number in the Grirdview row data bound in for loop but it only give me the last number in the all column i'm Using Asp.net C#
this the Gridview:
<asp:GridView ID="gvRptBattalion" runat="server" AutoGenerateColumns="False" CssClass="table" OnRowDataBound="gvRptBattalion_RowDataBound" Visible="false">
<Columns>
<asp:BoundField DataField="ReadinessTypeName" HeaderText="Type" />
<asp:BoundField DataField="SymbolicRate" HeaderText="Rate" />
<asp:TemplateField>
<HeaderTemplate>
<asp:Label runat="server" Text="SymbolicRate"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblImportanceRatio" runat="server"></asp:Label>
</ItemTemplate>
<ItemStyle Width="50px" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label runat="server" Text="Total"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblTotal" runat="server"></asp:Label>
</ItemTemplate>
<ItemStyle Width="50px" />
</asp:TemplateField>
<asp:BoundField DataField="BattalionDate" HeaderText="#">
<FooterStyle CssClass="hide_identity" />
<HeaderStyle CssClass="hide_identity" HorizontalAlign="Right" />
<ItemStyle CssClass="hide_identity" />
</asp:BoundField>
<asp:BoundField DataField="SUnitId" HeaderText="#">
<FooterStyle CssClass="hide_identity" />
<HeaderStyle CssClass="hide_identity" HorizontalAlign="Right" />
<ItemStyle CssClass="hide_identity" />
</asp:BoundField>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label runat="server" Text="TotalAll"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblFormla" runat="server"></asp:Label>
</ItemTemplate>
<FooterStyle CssClass="lbl" />
<HeaderStyle CssClass="lbl" HorizontalAlign="Right" />
<ItemStyle CssClass="lbl" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label runat="server" Text="TotalALL2"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblG" runat="server"></asp:Label>
</ItemTemplate>
<FooterStyle CssClass="lbl" />
<HeaderStyle CssClass="lbl" HorizontalAlign="Right" />
<ItemStyle CssClass="lbl" />
</asp:TemplateField>
</Columns>
</asp:GridView>
I have a GridView defined like this:
<asp:GridView ID="GridView_Messages" runat="server" AutoGenerateColumns="False" PageSize="5" CellPadding="4" AllowPaging="true" Width=100% AllowSorting="true" OnSorting="GridView_Messages_Sorting"
ForeColor="#333333" GridLines="None" OnRowDataBound="GridView_Messages_OnRowDataBound" OnPageIndexChanging="GridView_Messages_PageIndexChanged" OnRowCommand="GridView_Messages_OnRowCommand" EmptyDataText="<%$ Resources:Localization, NoMsg %>">
<%--CssClass="Grid" AlternatingRowStyle-CssClass="alt" PagerStyle-CssClass="pgr"--%>
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:TemplateField HeaderText="" ItemStyle-Width="75" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle">
<HeaderTemplate>
<asp:CheckBox ID="allchk" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="check" Text="" TextAlign="Right" AutoPostBack="false" Checked="false" runat="server" OnCheckedChanged="GridView_Messages_CheckedChanged"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="MessageID" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
<ItemTemplate>
<asp:Label ID="GridView_Messages_lblMessageID" runat="server" Text='<%# Eval("MessageID") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="<%$ Resources:Localization, Title2 %>" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" SortExpression="it.Title">
<ItemTemplate>
<asp:Label ID="GridView_Messages_lblTitle" runat="server" Text='<%# Eval("Title") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
<ItemTemplate>
<asp:Label ID="GridView_Messages_lblDescription" runat="server" Text='<%# Eval("Description")%>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FromUserID" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
<ItemTemplate>
<asp:Label ID="GridView_Messages_lblFromUserID" runat="server" Text='<%# Eval("FromUserID")%>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="<%$ Resources:Localization, From %>" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" SortExpression="it.UserName">
<ItemTemplate>
<asp:Label ID="GridView_Messages_lblFromUserName" runat="server" Text='<%# Eval("UserName")%>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Notes" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
<ItemTemplate>
<asp:Label ID="GridView_Messages_lblNotes" runat="server" Text='<%# Eval("Notes") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="<%$ Resources:Localization, IsRead %>" Visible="false" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" SortExpression="it.IsRead">
<ItemTemplate>
<asp:Label ID="GridView_Messages_lblIsRead" runat="server" Text='<%# Eval("IsRead") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="<%$ Resources:Localization, TimeSent %>" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" SortExpression="it.SentDateTime">
<ItemTemplate>
<asp:Label ID="GridView_Messages_lblDateTime" runat="server" Text='<%# Eval("SentDateTime") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="Msg_lnkBtnClk" runat="server" CommandName="SingleClick" Text="click"
Visible="true" CssClass="hidden"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="Msg_lnkBtnDblClk" runat="server" CommandName="DoubleClick" Text="dblClick"
Visible="true" CssClass="hidden"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#C7B88D" />
</asp:GridView>
I don't want my OnRowCommand to execute for the first column of my GridView. Actually I don't want my event to fire when some of my checkboxes is clicked. How to determine if I have clicked on a checkbox or I have clicked somewhere else in a gridview? In WPF I could use e.OriginalSource property but here this is not possible.
Using JQuery:
If you haven't already added JQuery to your page, add this tag to your page's head section:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
And this is the actual code. Add this after the link to JQuery, in the .aspx page's head section:
<script type="text/javascript">
$(function(){
$('#<%= GridView_Messages.ClientID %> input[type="checkbox"]')
.click(function(event){
event.stopPropagation();
event.preventDefault();
})
});
</script>
Hi I am developing a website using c# and asp.net. But my grid view is not showing properly for one page only. Whether I am using the same css class but still the output is something odd.
Here is the output I am getting:
here is my design view code for the grid:
<div style="width: 800px; align-content: center;">
<asp:GridView ID="gvMv" runat="server" AutoGenerateColumns="False" width="400px"
OnRowDataBound="gvMv_RowDataBound" CssClass="Grid" ShowFooter="True">
<FooterStyle Height="25" />
<RowStyle />
<PagerStyle />
<HeaderStyle />
<Columns>
<asp:BoundField DataField="day" HeaderText="Day" HeaderStyle-Width="150" ItemStyle-Height="25" HeaderStyle-Height="30">
<HeaderStyle Height="30px" Width="150px"></HeaderStyle>
<ItemStyle Height="25px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="0.30"></asp:TemplateField>
<asp:TemplateField HeaderText="1.00"></asp:TemplateField>
<asp:TemplateField HeaderText="2.00"></asp:TemplateField>
<asp:TemplateField HeaderText="2.50"></asp:TemplateField>
<asp:TemplateField HeaderText="4.00"></asp:TemplateField>
<asp:TemplateField HeaderText="5.00"></asp:TemplateField>
<asp:TemplateField HeaderText="1.50"></asp:TemplateField>
<asp:TemplateField HeaderText="Total" ItemStyle-ForeColor="#0099FF">
<ItemStyle ForeColor="#0099FF"></ItemStyle>
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" Font-Size="Smaller" />
<RowStyle CssClass="rSty" BackColor="#F7F7DE" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="true" ForeColor="White" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle CssClass="hSty" BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</div>
I want all of the column to be same width. Can anyone please help me on this?
Thank you.
I had the same issue and this is what worked for me
<asp:TemplateField ItemStyle-Width="150px" HeaderText="ABC" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<asp:Label ID="ABC" runat="server" Text ='<%# Eval("ABC")%>' ></asp:Label>
</ItemTemplate>
<HeaderTemplate>
<asp:TextBox ID="txtBusinessGroup" runat="server" onkeyup="filter_BusinessGroup(this)" CssClass="texbox_header" Width="130px" placeholder="ABC" Text="" ToolTip="TYPE IN THE ABC PLEASE"></asp:TextBox>
</HeaderTemplate>
<ItemStyle HorizontalAlign="Center" Width="150px" />
</asp:TemplateField>
I am showing textfield in the headertext which you can remove.
The width of the fields i change from
<ItemStyle HorizontalAlign="Center" Width="150px" />
or the actual textbox im using or the templatefield
<asp:TemplateField ItemStyle-Width="150px" HeaderText="ABC" ItemStyle-HorizontalAlign="center">
I hope this helps you and works for you or anyone else who might end up here.
thank you
Here is an example how you can do it :
<asp:TemplateField HeaderText="used">
<HeaderStyle Width="100" />
<ItemStyle Width="100" />
</asp:TemplateField>
You can use ItemStyle to set properties for your template field column
Try using this template code:
<asp:TemplateField HeaderText="ABC">
<ItemTemplate>
<asp:Label ID="lblABC" runat="server"
Text='<%#DataBinder.Eval(Container.DataItem, "ABCId") %>'>
</asp:Label>
</ItemTemplate>
<ItemStyle Width="20px" />
<HeaderStyle Width="20px" />
<FooterStyle Width="20px" />
<EditItemTemplate>
<asp:Label ID="lblEditABC" runat="server"
Text='<%#DataBinder.Eval(Container.DataItem, "ABCId") %>'>
</asp:Label>
</EditItemTemplate>
</asp:TemplateField>
i experienced the same. ItemStyle is not working! use HeaderStyle.
GridView1.Columns[2].HeaderStyle.Width = 20;
``If these all above code will note work to increase the width of gridview header then you can try this one also it will work definitely.Simply after YourText putt HTML space tag that is that much how much space you want.
**HeaderText="YourText "**
I have a grid that is data bound to a generic list. Which I edit and need to persist the changes of, to the db.
The problem is when I hit the submit button it does a PostBack. And sets the data source of the gridview to null.
I've tried storing the data source in the view state ViewState["data"] which works great but the data isn't being updated in the ViewState when changes are made on the grid.
Any ideas?
Here is the code for the GridView:
<asp:GridView ID="dgMerchantConfiguration" runat="server"
AutoGenerateColumns="False"
CausesValidation="False" CustomPagerCssClass="" HeaderHeight="30px" NumberOfPagesHeight="15px"
NumberOfPagesWidth="40px" PagerHeight="15px" PagerWidth="40px" ShowDataGridCustomPaging="None"
SortHeight="15px" SortWidth="70px" BackColor="White" BorderColor="#999999" BorderWidth="1px"
CellPadding="1" Font-Size="Smaller" GridLines="Vertical" Width="100%"
onrowdatabound="dgMerchantConfiguration_RowDataBound" ViewStateMode="Enabled" EnableViewState="False">
<SelectedRowStyle Font-Bold="True" ForeColor="White" BackColor="#f80000"></SelectedRowStyle>
<AlternatingRowStyle BackColor="Gainsboro"></AlternatingRowStyle>
<RowStyle ForeColor="Black" BackColor="#EEEEEE"></RowStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#bd0000" HorizontalAlign="Center"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<Columns>
<asp:BoundField DataField="Id" HeaderText="ID">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="CommissionType" HeaderText="Commission Type">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Select">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" Checked='<%# Bind("Selected") %>' OnCheckedChanged="chkSelect_CheckedChanged" AutoPostBack="True" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Override">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:CheckBox ID="chkOverride" runat="server" Checked='<%# Bind("Default") %>' OnCheckedChanged="chkOverride_CheckedChanged" AutoPostBack="True" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Comission Structure">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:DropDownList ID="drpCommissionStructure" runat="server" Width="200px" OnSelectedIndexChanged="drpCommissionStructure_SelectedIndexChanged" AutoPostBack="True"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Min">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtMin" runat="server" Width="50px" Text='<%# Bind("Min") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Max">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtMax" runat="server" Width="50px" Text='<%# Bind("Max") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fixed">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtFixed" runat="server" Width="50px" Text='<%# Bind("Fixed") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cost Per Unit">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtCostPerUnit" runat="server" Width="50px" Text='<%# Bind("CostPerUnit") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unit Value">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtUnitValue" runat="server" Width="50px" Text='<%# Bind("UnitValue") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Excluded Amount">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtExclAmount" runat="server" Width="50px" Text='<%# Bind("ExcludedAmount") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Percentage">
<HeaderStyle HorizontalAlign="Center" CssClass="NormalBold"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" CssClass="Normal"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtPercentage" runat="server" Width="50px" Text='<%# Bind("Percentage") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
And how the data source is set:
protected void ddlMerchants_SelectedIndexChanged(object sender, EventArgs e)
{
// Load the selected businesses config from the db
var t = client.GetMerchantCommissionStructure(new GetMerchantCommissionStructureRequest() { MerchantID = Int32.Parse(ddlMerchants.SelectedItem.Value) });
ViewState["data"] = t.Configurations;
dgMerchantConfiguration.DataSource = t.Configurations;
dgMerchantConfiguration.DataBind();
}
Thanks in Advance!
i have a gridview which simply displays records based on a filter from a dropdownlist, when i change the dropdownlist the page postbacks fine and the filter works, but when i click to edit a row the sort order changes based on the new filter. when i change the drop down back to the original filter and click edit the sort order remains the same.
any ideas?
<asp:DropDownList ID="ddlFilterDocs" runat="server"
AutoPostBack="True"
onselectedindexchanged="ddlFilterDocs_SelectedIndexChanged">
<asp:ListItem Text="MissingData"
Value="MissingData" >MissingData</asp:ListItem>
<asp:ListItem Text="AllData" Value="AllData"
>AllData</asp:ListItem>
</asp:DropDownList>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" PageSize="35"
AutoGenerateColumns="False" CellPadding="4"
ForeColor="#333333" GridLines="None"
onrowcommand="GridView1_RowCommand" DataKeyNames="customerCode"
onpageindexchanging="GridView1_PageIndexChanging"
onsorting="GridView1_Sorting">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField SortExpression="CustomerCode">
<ItemTemplate>
<asp:LinkButton ID="lbEdit" ForeColor="DarkGreen" Font-
Bold="True" CommandArgument='<%# Eval("customerCode") %>' CommandName="EditRow"
runat="server">Edit</asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="lbUpdate" CommandArgument='<%#
Eval("customerCode") %>' CommandName="UpdateRow" runat="server"
ForeColor="White">Update</asp:LinkButton>
<asp:LinkButton ID="lblCancel" CommandArgument='<%#
Eval("customerCode") %>' CommandName="CancelUpdate" runat="server"
ForeColor="White">Cancel</asp:LinkButton>
</EditItemTemplate>
<HeaderStyle Width="100px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Customer ID"
SortExpression="CustomerCode">
<EditItemTemplate>
<asp:Label ID="lblCustCodeEdit" runat="server" Text='<%#
Eval("CustomerCode") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblCustCode" runat="server" Text='<%#
Bind("CustomerCode") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Name" HeaderText="Name"
SortExpression="Name"
ReadOnly="True" >
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:TemplateField HeaderText="StreetAddress"
SortExpression="StreetAddress">
<EditItemTemplate>
<asp:TextBox ID="tbxStreetAddress" runat="server"
Text='<%# Bind("StreetAddress") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblStreetAddress" runat="server" Text='<%#
Bind("StreetAddress") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="City" SortExpression="City">
<EditItemTemplate>
<asp:TextBox ID="tbxCity" runat="server" Text='<%#
Bind("City") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblCity" runat="server" Text='<%#
Bind("City") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Width="100px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Zip" SortExpression="Zip">
<EditItemTemplate>
<asp:TextBox ID="tbxZip" runat="server" Text='<%#
Bind("Zip") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblZip" runat="server" Text='<%#
Bind("Zip") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Width="50px" />
</asp:TemplateField>
<asp:BoundField DataField="DocNumber" HeaderText="DocNumber"
SortExpression="DocNumber" ReadOnly="True">
<HeaderStyle Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="GrossAmount" HeaderText="Gross"
SortExpression="GrossAmount" ReadOnly="True"
DataFormatString="{0:c2}" >
<HeaderStyle Width="70px" />
</asp:BoundField>
<asp:BoundField DataField="NetAmount" HeaderText="Net"
SortExpression="NetAmount" ReadOnly="True" DataFormatString="
{0:c2}" >
<HeaderStyle Width="70px" />
</asp:BoundField>
<asp:BoundField DataField="VATAmount" HeaderText="VAT"
SortExpression="VATAmount" ReadOnly="True" DataFormatString="
{0:c2}" >
<HeaderStyle Width="70px" />
</asp:BoundField>
<asp:BoundField DataField="FromVoucNbr" HeaderText="Voucher"
SortExpression="FromVoucNbr" ReadOnly="True" >
<HeaderStyle Width="70px" />
</asp:BoundField>
<asp:BoundField DataField="LastModDate" HeaderText="Date"
SortExpression="LastModDate" ReadOnly="True"
DataFormatString="{0:G}" >
<HeaderStyle Width="70px" />
</asp:BoundField>
<asp:BoundField DataField="LastModUser" HeaderText="LastModUser"
SortExpression="LastModUser" ReadOnly="True">
<HeaderStyle Width="50px" />
</asp:BoundField>
</Columns>
<EditRowStyle BackColor="#7C6F57" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#666666" ForeColor="White"
HorizontalAlign="Center" />
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True"
ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:GridView>
If you are rebinding the data into the Row_Editing event then you need to filter that with the drop down selected value.
Regards,