Click here to Skip to main content
15,902,189 members

Comments by ashwini dharamsale (Top 9 by date)

ashwini dharamsale 22-Jan-14 9:45am View    
Unable to cast object of type 'System.Web.UI.WebControls.Calendar' to type 'System.Web.UI.WebControls.TextBox'.
ashwini dharamsale 22-Jan-14 9:42am View    
protected void gvTechnision_RowEditing(object sender, GridViewEditEventArgs e)
{
gvTechnision.EditIndex = e.NewEditIndex;
BindGrid();
}
ashwini dharamsale 21-Jan-14 9:36am View    
plz tell me why iam not able to store the data
ashwini dharamsale 21-Jan-14 9:01am View    
Here it self iam not able to pass while debuging

protected void InsertNewRecord(object sender, EventArgs e)
{
try
{
string strName = GlobalClass.dt.Rows[0]["TechnisionName"].ToString();
if (strName == "0")
{
GlobalClass.dt.Rows[0].Delete();
GlobalClass.adap.Update(GlobalClass.dt);
}
TextBox txtDate = GridView1.FooterRow.FindControl("txtNewDate") as TextBox;
TextBox txtName = GridView1.FooterRow.FindControl("txtNewName") as TextBox;
TextBox txtTask = GridView1.FooterRow.FindControl("txtNewTask") as TextBox;
TextBox txtStatus = GridView1.FooterRow.FindControl("txtNewStatus") as TextBox;
TextBox txtRemark = GridView1.FooterRow.FindControl("txtNewRemark") as TextBox;
DataRow dr = GlobalClass.dt.NewRow();
dr["Date"] = txtDate.Text.Trim();
dr["TechnisionName"] = txtName.Text.Trim();
dr["Task"] = txtTask.Text.Trim();
dr["Status"] = txtStatus.Text.Trim();
dr["Remark"] = txtRemark.Text.Trim();
GlobalClass.dt.Rows.Add(dr);
GlobalClass.adap.Update(GlobalClass.dt);
GridView1.ShowFooter = false;
FillGridView();
}
catch
{
Response.Write("<script> alert('Record not added...') </script>");
}
ashwini dharamsale 21-Jan-14 9:00am View    
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">

<div>

<asp:GridView ID="GridView1" runat="server" ShowHeaderWhenEmpty="True"

AutoGenerateColumns="False"

OnRowCancelingEdit="cancelRecord" OnRowEditing="editRecord"

CellPadding="3" GridLines="Horizontal" Width="1297px" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" >

<rowstyle horizontalalign="Center" backcolor="#E7E7FF" forecolor="#4A3C8C">

<alternatingrowstyle backcolor="#F7F7F7">

<footerstyle backcolor="#B5C7DE" forecolor="#4A3C8C">

<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />

<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />

<rowstyle backcolor="#E3EAEB">

<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />



<columns>



<asp:TemplateField>

<HeaderTemplate>Date</HeaderTemplate>

<itemtemplate>

<asp:Label ID ="lblDate" runat="server" Text='<%#Bind("Date")%>'>


<edititemtemplate>

<asp:TextBox ID="txtDate" runat="server" Text='<%#Bind("Date") %>' MaxLength="50">

<asp:RequiredFieldValidator ID="rfvtxtDate" runat="server" Text="*" ToolTip="Enter Date" ControlToValidate="txtDate">

<asp:RegularExpressionValidator ID="revtxtDate" runat="server" Text="*" ToolTip="Enter Date " ControlToValidate="txtDate" ValidationExpression="^[a-zA-Z'.\s]{1,40}$">





<footertemplate>

<asp:TextBox ID="txtNewDate" runat="server" MaxLength="50">

<asp:RequiredFieldValidator ID="rfvtxtNewDate" runat="server" Text="*" ToolTip="Enter Date" ControlToValidate="txtNewDate">

<asp:RegularExpressionValidator ID="revtxtNewDate" runat="server" Text="*" ToolTip="Enter Date " ControlToValidate="txtNewDate" ValidationExpression="^[a-zA-Z'.\s]{1,40}$">









<asp:TemplateField>

<HeaderTemplate>TechnisionName</HeaderTemplate>

<itemtemplate>

<asp:Label ID ="lblName" runat="server" Text='<%#Bind("TechnisionName") %>'>



<edititemtemplate>

<asp:TextBox ID="txtName" runat="server" Text='<%#Bind("TechnisionName") %>' MaxLength="50">

<asp:RequiredFieldValidator ID="rfvtxtName" runat="server" Text="*" ToolTip="Enter name" ControlToValidate="txtName">

<asp:RegularExpressionValidator ID="revtxtName" runat="server" Text="*" ToolTip="Enter alphabate " ControlToValidate="txtName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$">





<footertemplate>

<asp:TextBox ID="txtNewName" runat="server" MaxLength="50">

<asp:RequiredFieldValidator ID="rfvtxtNewName" runat="server" Text="*" ToolTip="Enter name" ControlToValidate="txtNewName">

<asp:RegularExpressionValidator ID="revtxtNewName" runat="server" Text="*" ToolTip="Enter alphabate " ControlToValidate="txtNewName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$">