I am using a ModalPopupExtender in a GridView. When the user clicks link button in the grid to update the row values, the modal popup opens. The user updates the values and click on the update button.
I have used validation controls in the modal popup, but the when the user click update button the form submits with out validating the controls.
I tried with ValidationGroup as it's mentioned in some forums but no luck. Can any one help how to fix this or any good examples.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
</div><asp:Button ID="btnShowPopup" runat="server" Text="Button" style="display:none"/><div >
<asp:GridView ID="GridView2" runat="server" BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4"
AutoGenerateColumns="False" ForeColor="Black" Width="100%"
onrowcreated="GridView2_RowCreated" onrowdatabound="GridView2_RowDataBound">
<Columns>
<asp:BoundField DataField="ShortDescription" HeaderText="ShortDescription" ReadOnly="True" ><ItemStyle Width="32%" /></asp:BoundField>
<asp:BoundField DataField="Planned" HeaderText="Planned" ReadOnly="True" >
<ItemStyle Width="5%" HorizontalAlign="Right" /></asp:BoundField>
<asp:BoundField DataField="Actual" HeaderText="Actual" ReadOnly="True" >
<ItemStyle Width="5%" HorizontalAlign="Right" /></asp:BoundField>
<asp:BoundField DataField="Error" HeaderText="Error" ReadOnly="True" >
<ItemStyle Width="5%" HorizontalAlign="Right" /></asp:BoundField>
<asp:BoundField DataField="Volume" HeaderText="Vol" ReadOnly="True"
DataFormatString="{0:#%}" >
<ItemStyle Width="3%" HorizontalAlign="Right" /></asp:BoundField>
<asp:BoundField DataField="Mix" HeaderText="Mix" ReadOnly="True"
DataFormatString="{0:#%}" >
<ItemStyle Width="3%" HorizontalAlign="Right" /></asp:BoundField>
<asp:BoundField DataField="PMReason" HeaderText="Reason" ><ItemStyle Width="9%" /></asp:BoundField>
<asp:BoundField DataField="PMComment" HeaderText="Comment" ><ItemStyle Width="9%" /></asp:BoundField>
<asp:BoundField DataField="PMPlanned" HeaderText="Planned" >
<ItemStyle Width="5%" HorizontalAlign="Right" /></asp:BoundField>
<asp:BoundField DataField="PMActual" HeaderText="Actual" ReadOnly="True" >
<ItemStyle Width="5%" HorizontalAlign="Right" /></asp:BoundField>
<asp:BoundField DataField="PMError" HeaderText="Error" >
<ItemStyle Width="5%"
HorizontalAlign="Right" /></asp:BoundField>
<asp:BoundField DataField="PMVolume" HeaderText="Vol" ReadOnly="True"
DataFormatString="{0:#%}" >
<ItemStyle Width="3%" HorizontalAlign="Right" /></asp:BoundField>
<asp:BoundField DataField="PMMix" HeaderText="Mix" ReadOnly="True"
DataFormatString="{0:#%}" >
<ItemStyle Width="3%" HorizontalAlign="Right" /></asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="btnSelect" runat="server" CausesValidation="false"
ImageUrl="~/Images/edit.png"
ImageAlign="AbsMiddle" Height="15px" Width="15px"
onclick="btnSelect_Click" />
</ItemTemplate>
<ItemStyle Width="3%" />
</asp:TemplateField>
<asp:BoundField DataField="ReportRowId" Visible="False" />
</Columns>
<FooterStyle BackColor="#CCCC99" ForeColor="Black" />
<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
</asp:GridView>
</div>
<cc2:ModalPopupExtender ID="gv_ModalPopupExtender" runat="server"
TargetControlID="btnShowPopup"
PopupControlID="pnlModalPanel"
CancelControlID="btnCancel"
BackgroundCssClass="modalBackground"/>
<asp:Panel ID="pnlModalPanel" runat="server" Style="display: none;" BackColor="Red">
<table>
<tr>
<th colspan="2" align="center" style="color:White; font-size:larger"> POST MITIGATION </th>
</tr>
<tr>
<td>
<asp:Label ID="lblRowId" runat="server" Style="display: none;"></asp:Label> </td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="lblDevice" runat="server"
ForeColor="White" Font-Bold="True">Device:</asp:Label> </td>
<td><asp:TextBox ID="txtDevice" runat="server" Width="150px" ReadOnly="true"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblPlanned" runat="server"
ForeColor="White" Font-Bold="True">Planned:</asp:Label> </td>
<td><asp:TextBox ID="txtPlanned" runat="server" Width="150px" ReadOnly="true"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblActual" runat="server"
ForeColor="White" Font-Bold="True">Actual:</asp:Label> </td>
<td><asp:TextBox ID="txtActual" runat="server" Width="150px"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblError" runat="server"
ForeColor="White" Font-Bold="True">Error:</asp:Label> </td>
<td><asp:TextBox ID="txtError" runat="server" Width="150px" ReadOnly="true"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblReason" runat="server"
ForeColor="White" Font-Bold="True">Reason:</asp:Label> </td>
<td>
<asp:DropDownList ID="ddlReason" runat="server" Width="150px" ValidationGroup="valReason">
<asp:ListItem>-- Select Reason --</asp:ListItem>
<asp:ListItem></asp:ListItem>
<asp:ListItem>Availability LT</asp:ListItem>
<asp:ListItem>Availability ST</asp:ListItem>
<asp:ListItem>Competitor Response</asp:ListItem>
<asp:ListItem>Credit</asp:ListItem>
<asp:ListItem>Plan Issue</asp:ListItem>
<asp:ListItem>Props Change</asp:ListItem>
<asp:ListItem>SCL Request</asp:ListItem>
<asp:ListItem>Launch Delay</asp:ListItem>
<asp:ListItem>Launch Forward</asp:ListItem>
<asp:ListItem>Phasing</asp:ListItem>
<asp:ListItem>Opportunity-Positive</asp:ListItem>
<asp:ListItem>Opportunity-Negative</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvReason" ValidationGroup="valReason" runat="server" Text="*" ErrorMessage="RequiredFieldValidator"
ControlToValidate="ddlReason" Display="Dynamic" ForeColor="White" InitialValue="-- Select Reason --"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
<asp:Label ID="lblComment" runat="server"
ForeColor="White" Font-Bold="True">Comment:</asp:Label> </td>
<td><asp:TextBox ID="txtComment" TextMode="MultiLine" Height="50px" runat="server" Width="150px"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="btnUpdate" runat="server" CausesValidation="true" ValidationGroup="valReason"
Text="Update Mitigation" onclick="btnUpdate_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel"/></td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
It worked when I removed the update button from the panel and replaced it with the new button.
But I am not sure why it didn't work before and why its working now. Its all the same code. Looks very strange to me.
Related
Web page is designed using .Net framework 4.5. Web pages contains 3 Grid views as follows:
Code for Gridview is as follows:
<asp:GridView ID="grdADetails" runat="server" AutoGenerateColumns="False" CssClass="tGrid" GridLines="Horizontal" ShowFooter="True" Width="100%" OnRowCancelingEdit="grdADetails_RowCancelingEdit" OnRowCommand="grdADetails_RowCommand" OnRowDataBound="grdADetails_RowDataBound" OnRowDeleting="grdADetails_RowDeleting" OnRowEditing="grdADetails_RowEditing" OnRowUpdating="grdADetails_RowUpdating">
<Columns>
<asp:TemplateField HeaderText="Mode Of Transport">
<EditItemTemplate>
<asp:DropDownList ID="DrpTMode" runat="server" CssClass="trvGridCmbBox" Width="90%">
</asp:DropDownList>
</EditItemTemplate>
<FooterTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="WIDTH: 100%">
<tr>
<td class="tGridTotal" style="Height : 25px;"></td>
</tr>
<tr>
<td class="GridEditArea" style="Height : 25px;">
<asp:DropDownList ID="DrpNTMode" runat="server" CssClass="trvGridCmbBox" Font-Size="8pt" Width="98%">
</asp:DropDownList>
</td>
</tr>
</table>
</FooterTemplate>
<HeaderTemplate>
<asp:Label ID="lblTMode" runat="server" Text="<%$ Resources:EResources, lblModeOfT %>" Width="100%"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblESubTypeCode" runat="server" Text='<%# Bind("ESubTypeCode") %>' Visible="False"></asp:Label>
<asp:Label ID="lblTMode" runat="server" Text='<%# Bind("TMode") %>'></asp:Label>
</ItemTemplate>
<FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="12%" />
</asp:TemplateField>
//For Date part using Ajax Control
<asp:TemplateField HeaderText="Departure On">
<EditItemTemplate>
<asp:TextBox ID="txtDeptOn" runat="server" CssClass="trvGridTextBox" Text='<%# Bind("DeptOn") %>' Width="90%"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="ceDeptOn" runat="server" Format="MM/dd/yyyy" TargetControlID="txtDeptOn" Enabled="true" Animated="true" EnabledOnClient="true" EnableViewState="true" FirstDayOfWeek="Default"/>
</EditItemTemplate>
<FooterTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="WIDTH: 100%">
<tr>
<td class="tGridTotal" style="Height : 25px;"></td>
</tr>
<tr>
<td class="GridEditArea" style="Height : 25px;">
<asp:TextBox ID="txtNewDeptOn" runat="server" CssClass="trvGridTextBox" Width="100%"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="ceNewDeptOn" runat="server" Enabled="true" Format="MM/dd/yyyy" TargetControlID="txtNewDeptOn" Animated="true" EnabledOnClient="true" EnableViewState="true" FirstDayOfWeek="Default"/>
</td>
</tr>
</table>
</FooterTemplate>
<HeaderTemplate>
<asp:Label ID="lblDepartureOn" runat="server" Text="<%$ Resources:EASEResources, lblDeparOn %>" Width="100%"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblDeptOn" runat="server" Text='<%# Bind("DeptOn") %>'></asp:Label>
</ItemTemplate>
<FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="10%" />
</asp:TemplateField>
//Same as above for remaining columns
//For Edit button column
<asp:TemplateField HeaderText="Edit">
<EditItemTemplate>
<asp:ImageButton ID="ImgUpdate" runat="server" CommandName="Update" ImageUrl="~/PL/images/save.png" />
<asp:ImageButton ID="ImageButton4" runat="server" CommandName="Cancel" ImageUrl="~/PL/images/remove1.png" />
</EditItemTemplate>
<FooterTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="WIDTH: 100%">
<tr>
<td class="tGridTotal" style="height: 25px"></td>
</tr>
<tr>
<td class="GridEditArea" aria-orientation="vertical" style="height: 25px">
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="AddNew" CssClass="trvGridTextBox" ImageUrl="~/PL/images/save.png" />
</td>
</tr>
</table>
</FooterTemplate>
<HeaderTemplate>
<asp:Label ID="lblEdit" runat="server" Text="<%$ Resources:EResources, lblEdit %>" Width="100%"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="ImageButton2" runat="server" CommandName="Edit" ImageUrl="~/PL/images/edit.png" />
</ItemTemplate>
<FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="4%" />
</asp:TemplateField>
Remaining two grid views are created in the similar format.
<asp:GridView ID="GrdTDetail" runat="server" AutoGenerateColumns="False" CssClass="travelGrid" GridLines="Horizontal" ShowFooter="True" Width="100%" OnRowCancelingEdit="GrdTDetail_RowCancelingEdit" OnRowCommand="GrdTDetail_RowCommand" OnRowDataBound="GrdTDetail_RowDataBound" OnRowDeleting="GrdTDetail_RowDeleting" OnRowEditing="GrdTDetail_RowEditing" OnRowUpdating="GrdTDetail_RowUpdating">
<Columns>
//Other Column Code
//Edit Column Code.
<asp:TemplateField HeaderText="Edit">
<EditItemTemplate>
<asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="False" CommandName="Update" ImageUrl="~/PL/images/save.png" />
<asp:ImageButton ID="ImageButton4" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/PL/images/remove1.png" />
</EditItemTemplate>
<FooterTemplate>
<table border="0" style="WIDTH: 100%">
<tr>
<td class="travelGridTotal" style="Height : 25px;"></td>
</tr>
<tr>
<td class="GridEditArea" style="Height : 25px;">
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="AddNewACC" CssClass="trvGridTextBox" ImageUrl="~/PL/images/save.png" />
</td>
</tr>
</table>
</FooterTemplate>
<HeaderTemplate>
<asp:Label ID="lblEdit" runat="server" Text="<%$ Resources:EResources, lblEdit %>" Width="100%"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" CommandName="Edit" ImageUrl="~/PL/images/edit.png" />
</ItemTemplate>
<FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="4%" />
</asp:TemplateField>
</Columns>
<FooterStyle CssClass="GridFooter" />
<HeaderStyle CssClass="travelGridhead" /
</asp:GridView>
//3rd Gridview code
<asp:GridView ID="GrdOtherExp" runat="server" AutoGenerateColumns="False" CellPadding="0" CssClass="travelGrid" GridLines="Horizontal" ShowFooter="True" Width="100%" OnRowCancelingEdit="GrdOtherExp_RowCancelingEdit" OnRowCommand="GrdOtherExp_RowCommand" OnRowDataBound="GrdOtherExp_RowDataBound" OnRowDeleting="GrdOtherExp_RowDeleting" OnRowEditing="GrdOtherExp_RowEditing" OnRowUpdating="GrdOtherExp_RowUpdating">
<Columns>
//Other Column Code
//Edit Column Code
<asp:TemplateField HeaderText="Edit">
<EditItemTemplate>
<asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="False" CommandName="Update" ImageUrl="~/PL/images/save.png" />
<asp:ImageButton ID="ImageButton4" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/PL/images/close.png" />
</EditItemTemplate>
<FooterTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="WIDTH: 100%">
<tr>
<td class="travelGridTotal"></td>
</tr>
<tr>
<td class="GridEditArea"> <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="AddNewOExp" CssClass="trvGridTextBox" ImageUrl="~/PL/images/save.png" Height="16px" Width="16px" />
</td>
</tr>
</table>
</FooterTemplate>
<HeaderTemplate>
<asp:Label ID="lblEdit" runat="server" Text="<%$ Resources:EResources, lblEdit %>" Width="100%"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" CommandName="Edit" ImageUrl="~/PL/images/edit.png" />
</ItemTemplate>
<FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="2%" />
</asp:TemplateField>
</Columns>
<FooterStyle CssClass="GridFooter" />
<HeaderStyle CssClass="travelGridhead" /
</asp:GridView>
Each grid view has its own RowEditing, RowDataBound, RowUpdating, RowCancelEditing events. Gridview functionality is as follows:
User can enter data from footer row and using Save button having
command name as 'AddNew' saves the entered data to Item template in
row format. RowCommand event code is as follows:
protected void grdADetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
DataTable dtADetails = (DataTable)ViewState["dtAccDetails"];
ViewState["dtADetails"] = dtADetails;
if (e.CommandName.Equals("AddNew"))
{
//function to add data
//function to check required fields
}
}
User can edit and update the row data on RowEding event. Row edit button has command name as 'Edit'.
protected void grdADetails_RowEditing(object sender, GridViewEditEventArgs e)
{
grdADetails.EditIndex = e.NewEditIndex;
DataTable dtADetails = (DataTable)ViewState["dtADetails"];// cache data to session
//Code for editing the functionality.
}
User can save the edited row data or cancel the editing.
After publishing the pages to production server only one grid view events get fired, remaining two grid view events do not gets fired. Each editing button has command name as 'Edit' to fire edit event. Each
I have a ASP.NET DataGrid databinded from datatable after SQL query.
The DataGrid is populated with organization employee personal info.
Every row contains "Send Greeting" button.
I would like to disable or hide this button if the "Email Address" cell in that row, if Email Address is empty.
My ASP code:
<table dir="rtl">
<tr>
<asp:Label ID="lbl1" runat="server" CssClass="bDayLable" Text="Select a rpw and click on button to send greeting"></asp:Label>
</tr>
<tr>
<td colspan="2">
<div id="divMyPath" runat="server"></div>
<div id="divResults" runat="server">
<asp:DataGrid ID="grdResult" runat="server" BorderColor="#CCCCCC" BorderWidth="2px" Font-Bold="False" Font-Italic="False" Font-Names="Segoe UI" Font-Overline="False" Font-Size="13px" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Right" AutoGenerateColumns="False" Cellpadding="2" CellSpacing="2" AllowPaging="True" PageSize="4" AllowSorting="True" OnPageIndexChanged="grdResult_PageIndexChanging">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<%-- <img src="\\blabla\pictures\<%# Eval("Employeeno")%>.JPG" class="phoneBookImage" />--%>
<img src="http://intranet.somedomain.com/UserProfiles/pictures/<%# Eval("Employeeno")%>.JPG" class="phoneBookImage" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Employee Name">
<ItemTemplate>
<%# Eval("firstname") & " " & Eval("surname")%>
</ItemTemplate>
</asp:TemplateColumn>
<%-- <asp:BoundColumn DataField="EmailAdd" HeaderText="Email" DataFormatString="{0:n2}"></asp:BoundColumn>--%>
<asp:TemplateColumn HeaderText="Email">
<ItemTemplate>
<a href='mailto:<%# Eval("EmailAdd")%>'> <%# Eval("EmailAdd")%> </a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Greeting">
<ItemTemplate>
<asp:Button ButtonType="Button" ID="btnSendGreeting" runat="server" CssClass="btnSendGreeting" Text="Send Greeting" Visible="true" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<FooterStyle BackColor="#00CC00" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
<HeaderStyle BackColor="Gray" Font-Bold="True" Font-Italic="False" Font-Names="Segoe UI" Font-Overline="False" Font-Size="Small" Font-Strikeout="False" Font-Underline="False" ForeColor="White" HorizontalAlign="Center" VerticalAlign="Middle" />
<SelectedItemStyle BackColor="#CCFFCC" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
</asp:DataGrid>
</div>
</td>
</tr>
My code behind contains the function to fill the DataGrid from Data Table.
Thanks in advance!!!
Try to set the Enabled (or Visible) property like this:
<asp:Button ButtonType="Button" ID="btnSendGreeting" runat="server" CssClass="btnSendGreeting" Text="Send Greeting" Enabled='<%# Eval("EmailAdd") != null && !String.IsNullOrEmpty(Eval("EmailAdd").ToString()) %>' />
You can put all sorts of expressions between '<%# %>'.
here I'm trying to make a scroll-able Grid View, which I did using the overflow, but the problem is, I want to make the Header section static, allowing only the content to be scrolled, here's my code:
<div class="BodyDiv" style="overflow: auto; height: 200px">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table width="1024px">
<tr>
<td align="center">
<table width="980px">
<tr>
<td>
<asp:Panel ID="PanelDGV" runat="server" Height="250" ScrollBars="None" Width="515">
<asp:GridView ID="DGV" runat="server" AutoGenerateColumns="False" GridLines="None" AllowPaging="true" PageSize="50" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt">
<Columns>
<asp:BoundField DataField="ProjectCode" HeaderText="Project Code" />
<asp:BoundField DataField="ProjectName" HeaderText="Project Name" />
<asp:ButtonField ButtonType="Image" ImageUrl="../Support/Image/Edit.png" ItemStyle-HorizontalAlign="Center"
CommandName="CmdSearch" HeaderText="Edit">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonField>
</Columns>
<PagerStyle CssClass="pgr"></PagerStyle>
<AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
</asp:GridView>
</asp:Panel>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
is there anyway to do it? thank you.
<script src="../Scripts/ScrollableGridPlugin.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$('#<%=Grd.ClientID %>').Scrollable();
}
)
You can download this js file from below url
http://code.google.com/p/dev-acuaman/source/browse/trunk/PyproduceEstad%C3%ACstica/EstadisticaProduce/Scripts/ScrollableGridPlugin.js?r=79
<asp:GridView ID="Grd" runat="server" Width="100%" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Country">
<ItemTemplate>
<asp:Label ID="lbl" runat="server" Text='<%# Eval("CountryName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Enter Shipping Charge">
<ItemTemplate>
<asp:TextBox ID="txt" runat="server" Text='<%# Eval("charge") %>'></asp:TextBox>
<asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="txt"
ValidationGroup="txt" SetFocusOnError="true" Operator="DataTypeCheck" Type="Double"
ErrorMessage="Country Wise Shipping Charge must be number!">*</asp:CompareValidator>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" Width="160px" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Enter No Of Days">
<ItemTemplate>
<asp:TextBox ID="txt1" runat="server" Text='<%# Eval("days") %>'></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txt"
ValidationGroup="txt1" SetFocusOnError="true" Operator="DataTypeCheck" Type="Integer"
ErrorMessage="No Of Days must be number!">*</asp:CompareValidator>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" Width="160px" VerticalAlign="Middle" />
</asp:TemplateField>
</Columns>
</asp:GridView>
My code sample is given below!
<%# Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="SMS_Table.aspx.cs" Inherits="Web_sms_alert.SMS_Table" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp"%>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:Label ID="Label1" runat="server" Font-Bold="true" Text="From: "></asp:Label>
<asp:TextBox ID="tbDatefrom" Font-Names="Segoe UI" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" Format="yyyy-MM-dd" DefaultView="Days" TargetControlID="tbDatefrom" runat="server">
</asp:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="tbDatefrom" Font-Bold="true" ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:Label ID="Label2" runat="server" Font-Bold="true" Text="To: "></asp:Label>
<asp:TextBox ID="tbDateTo" Font-Names="Segoe UI" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender2" Format="yyyy-MM-dd" DefaultView="Days" TargetControlID="tbDateTo" runat="server">
</asp:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="tbDateTo" Font-Bold="true" ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:Button runat="server" ID="btnSearch" CssClass="buttons" Text="Search" OnClick="btnSearchDW" /></br>
<div style="float: left; width: 98%; height: 30px;"><asp:CheckBox ID="cbDateRange" runat="server" Font-Bold="true" Font-Names="Segoe UI" Text="Date Range" /> <asp:CheckBox ID="cbsmsday" Text="SMS/Day" Font-Bold="true" Font-Names="Segoe UI" runat="server" /></div>
<asp:UpdatePanel ID="upl" runat="server">
<ContentTemplate>
<asp:GridView ID="GridviewSMS_Table" runat="server"
EnableSortingAndPagingCallbacks="false" AllowPaging="true" PageSize="20"
BorderColor="Chocolate" BorderStyle="None" OnPageIndexChanging="GridView1_PageIndexChanging"
BorderWidth="1px" CellPadding="3" GridLines="Vertical" Font-Names="Segoe UI" Width="354px">
<RowStyle BackColor="Wheat" ForeColor="Black" HorizontalAlign="Left" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="btnLinkView" runat="server" OnClick="btnLinkView_click">Text</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" Font-Size="Medium" />
<EditRowStyle BackColor="#000084" Font-Bold="True" ForeColor="White" Font-Size="Medium" />
</asp:GridView>
<asp:Panel ID="PanelText" runat="server" CssClass="ModalPopup" style="display:none">
<table border="1" align="center" style="border-color: #FF6600">
<tr>
<td> <asp:Label ID="lblTextShow" ForeColor="Black" Text="Text Message: " runat="server"></asp:Label></td>
<td><asp:TextBox ID="tbMessage" runat="server" TextMode="MultiLine" ForeColor="Black" Height="150px" Width="200px"></asp:TextBox></td>
</tr>
<tr align="center" valign="middle">
<td colspan="2">
<asp:Button ID="btnClose" runat="server" ForeColor="Black" Text="Close" />
</td> </tr>
</table>
</asp:Panel>
<asp:Button ID="btncontrol" runat="server" style="display:none" />
<asp:ModalPopupExtender ID="mpeMessage" runat="server" Enabled="true"
TargetControlID="btncontrol" PopupControlID="PanelText"
BackgroundCssClass="ModalBackground" CancelControlID="btnClose">
</asp:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
<div align="center">
<asp:Label ID="lblTotalDp" Font-Bold="true" Visible="false" ForeColor="Black" runat="server" Text="Total: "></asp:Label>
<asp:Label ID="lbltotal" Font-Bold="true" Visible="false" ForeColor="Black" runat="server"></asp:Label></div>
</div>
the page is shown in google chrome and IE good Like below
while in fire fox the grid-view is outside content place holder of masterpage! Like below
I didnt understand why this problem i am facing??? Please help me out of this.
remove from <div style="float: left the float:left
I do not see any reason for that, and the float is making this problem.
I have a Grid view in which a text box is present in footer and edit template from where user can update data. i made a table inside a empty template of a grid and add a server side text box on it so that user can insert data in a grid if there is no record present inside a grid.
There is a server side button present out side the grid, on clicking of that button i m saving the data that user insert or update via grid. Now i am facing the problem to find out the control present inside the empty template of the grid while i m saving the data.
My code looks like as :
<asp:GridView ID="grwBrandInfo" runat="server" Width="100%" HeaderStyle-CssClass="gridheaderstyle"
GridLines="Vertical" AutoGenerateColumns="false" ShowFooter="True" BackColor="White"
OnRowCommand="grwBrandInfo_RowCommand" OnRowEditing="grwBrandInfo_RowEditing"
OnRowDeleting="grwBrandInfo_RowDeleting" OnRowUpdating="grwBrandInfo_RowUpdating"
OnRowDataBound="grwBrandInfo_RowDataBound" OnRowCancelingEdit="grwBrandInfo_RowCancelingEdit"
BorderStyle="None">
<Columns>
<asp:TemplateField HeaderText="Quarts">
<ItemTemplate>
<%#Eval("QUARTS")%>
<asp:HiddenField ID="hdnPERMIT_QUANTITY_ID" runat="server" Value='<%#Eval("PERMIT_QUANTITY_ID") %>' />
<asp:HiddenField ID="hdnQuarts" runat="server" />
</ItemTemplate>
<FooterTemplate>
<asp:HiddenField ID="hdnPERMIT_QUANTITY_ID" runat="server" Value='<%#Eval("PERMIT_QUANTITY_ID") %>' />
<asp:TextBox ID="txtFootQuarts" runat="server" CssClass="txtfields" MaxLength="4"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:HiddenField ID="hdnPERMIT_QUANTITY_ID" runat="server" Value='<%#Eval("PERMIT_QUANTITY_ID") %>' />
<asp:TextBox ID="txtEditQuarts" runat="server" EnableViewState="false" Text='<%#Eval("QUARTS")%>'
CssClass="txtfields" MaxLength="4"></asp:TextBox>
</EditItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
<FooterStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField>
<FooterTemplate>
<asp:LinkButton ID="lbtnInsert" runat="server" Text="Insert" CssClass="hypfield"
CommandName="Insert" ValidationGroup="save"></asp:LinkButton>
</FooterTemplate>
<FooterStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" HeaderText="Action" ShowDeleteButton="true"
ValidationGroup="save">
<ItemStyle CssClass="hypfield" HorizontalAlign="Center" VerticalAlign="Top" />
<ControlStyle CssClass="hypfield" />
<HeaderStyle HorizontalAlign="Center" />
</asp:CommandField>
</Columns>
<EmptyDataTemplate>
<table border="1" cellpadding="5" cellspacing="0" width="100%">
<tr align="Left" bgcolor="#726E6D">
<td>
<b>
<asp:HiddenField ID="hdnPERMIT_QUANTITY_ID" runat="server" Value='0' />
<asp:Label ID="lblQuarts" runat="server" ForeColor="white" Text="Quarts" CssClass="lblfields"></asp:Label></b>
</td>
</tr>
<tr align="left" id="trEntryNotCompleted" runat="server" bgcolor="#FFFFEE">
<td>
<asp:TextBox ID="txtQuarts" runat="server" CssClass="txtfields5char" MaxLength="4"></asp:TextBox>
</td>
</tr>
</table>
</EmptyDataTemplate>
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle BackColor="#6B696B" CssClass="gridheaderstyle" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:Button ID="btnSave" runat="server" Text="Save" ValidationGroup="save" OnClick="btnSave_Click" />
So the problem is that how did i find the value of txtQuarts present in the empty template when i am saving data
Dim txtId As String = CType(gridHelpDesk.Controls(0).Controls(0).FindControl("txtId"), TextBox).Text