Click here to Skip to main content
15,890,557 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionFileUploading gives error on Production Server Pin
meeram39519-Jul-09 19:03
meeram39519-Jul-09 19:03 
AnswerRe: FileUploading gives error on Production Server Pin
Brij19-Jul-09 19:26
mentorBrij19-Jul-09 19:26 
GeneralRe: FileUploading gives error on Production Server Pin
meeram39519-Jul-09 19:37
meeram39519-Jul-09 19:37 
AnswerRe: FileUploading gives error on Production Server Pin
Abhijit Jana19-Jul-09 19:30
professionalAbhijit Jana19-Jul-09 19:30 
GeneralRe: FileUploading gives error on Production Server Pin
meeram39519-Jul-09 19:42
meeram39519-Jul-09 19:42 
GeneralRe: FileUploading gives error on Production Server Pin
Abhijit Jana19-Jul-09 19:47
professionalAbhijit Jana19-Jul-09 19:47 
AnswerRe: FileUploading gives error on Production Server Pin
N a v a n e e t h19-Jul-09 22:25
N a v a n e e t h19-Jul-09 22:25 
QuestionDataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Coupon_Info'. Pin
haleemasher19-Jul-09 18:23
haleemasher19-Jul-09 18:23 
my data source contain table with the name of Coupon_Info having 3 records
plz help
 <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" CellPadding="4" 
            DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" 
            style="z-index: 1; top: 413px; left: 285px; position: absolute; height: 172px; width: 476px; margin-right: 88px" 
            onrowcancelingedit="GridView1_RowCancelingEdit" 
            OnRowUpdating="UpdateRecord" 
            onrowediting="GridView1_RowEditing" PageSize="5">
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#E3EAEB" />
            <Columns>
            
               <asp:TemplateField HeaderText="Date" HeaderStyle-HorizontalAlign="Left" SortExpression="RecievingDate">
               <ItemTemplate >
               <asp:Label ID="lbl1" runat ="server" Text ='<%# Eval("Coupon_Info.RecievingDate") %>'></asp:Label>
               </ItemTemplate>

 <EditItemTemplate>
   <asp:TextBox ID="txtDate" Width="100px" runat="server" Text='<% Bind("Coupon_Info.RecievingDate") %>'></asp:TextBox>
 </EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Coupon" SortExpression="CouponName">

 <EditItemTemplate>
  <asp:TextBox ID="txtcoupon"  Width="100px" runat="server" Text='<% Bind("CouponType.CouponName") %>'></asp:TextBox>
 </EditItemTemplate>

  <ItemTemplate>
    <asp:Label ID="lblcoupon1" Width="100px" runat="server" Text='<%# Eval("CouponType.CouponName") %>'></asp:Label>
  </ItemTemplate>
  
</asp:TemplateField>

<asp:TemplateField HeaderText="Serial Start" SortExpression="Serial_Start">
  <EditItemTemplate>
   <asp:TextBox ID="txtstart"  Width="100px" runat="server" Text='<% Bind("Coupon_Info.Serial_Start") %>'></asp:TextBox>
  </EditItemTemplate>

   <ItemTemplate>
     <asp:Label ID="lblstart1"  Width="100px" runat="server" Text='<%# Eval ("Coupon_Info.Serial_Start") %>'></asp:Label>
   </ItemTemplate>
</asp:TemplateField>


<asp:TemplateField HeaderText="End" SortExpression="Serial_End">

         <EditItemTemplate>
            <asp:TextBox ID="txtend" Width="100px" runat="server" Text='<% Bind("Coupon_Info.Serial_End") %>'></asp:TextBox>
         </EditItemTemplate>

         <ItemTemplate>
            <asp:Label ID="lblend1" Width="100px" runat="server" Text='<%# Eval ("Coupon_Info.Serial_End") %>'></asp:Label>
         </ItemTemplate>
   
      
</asp:TemplateField>

        <asp:TemplateField HeaderText="Recieved By" SortExpression="Recieved_By">

            <EditItemTemplate>

                <asp:TextBox ID="txtby" Width="100px" runat="server" Text='<% Bind("Coupon_Info.Recieved_By") %>'></asp:TextBox>

            </EditItemTemplate>

   <ItemTemplate >

       <asp:Label ID="lblby1" Width="100px" runat="server" Text='<%# Eval("Coupon_Info.Recieved_By") %>'></asp:Label>

   </ItemTemplate>


</asp:TemplateField>




               
<asp:TemplateField HeaderText="Edit" ShowHeader="False"> 
<EditItemTemplate> 

<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton> 

<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton> 

</EditItemTemplate> 
<ItemTemplate> 

<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> 

</ItemTemplate>
</asp:TemplateField>

            </Columns>
            
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" 
                Height="4px" />
            <EditRowStyle BackColor="#7C6F57" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView> 
                              

       
 
         </asp:Panel>  
        </div>
        
    </asp:Panel>  
   <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Coupon ManagementConnectionString9 %>" 
            SelectCommand="SELECT Coupon_Info.RecievingDate AS Date, CouponType.CouponName AS Name, Coupon_Info.Serial_Start AS [Serial Start], Coupon_Info.Serial_End AS [Serial End], Coupon_Info.Recieved_By AS [Recieved By] FROM Coupon_Info INNER JOIN CouponType ON Coupon_Info.Coupon_TypeID = CouponType.CouponTypeID">
                   </asp:SqlDataSource>

in C#
 public partial class CouponRecieving : System.Web.UI.Page
    {
        SqlConnection cnx = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|Coupon Management.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
        SqlDataAdapter da1 = new SqlDataAdapter();
        DataSet ds = new DataSet();
        SqlCommand cmd = new SqlCommand();
        DataTable dataTable;


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                FillVendorGrid();

            }
        }



      private void FillVendorGrid()
      {

          dataTable = new DataTable();

          cmd.Connection = cnx;

          cmd.CommandText = "SELECT Coupon_Info.RecievingDate AS Date, CouponType.CouponName AS Name, Coupon_Info.Serial_Start AS [Serial Start], Coupon_Info.Serial_End AS [Serial End], Coupon_Info.Recieved_By AS [Recieved By] FROM Coupon_Info INNER JOIN CouponType ON Coupon_Info.Coupon_TypeID = CouponType.CouponTypeID";

          da1  = new SqlDataAdapter(cmd);

          da1.Fill(dataTable);
          GridView1.DataSource = dataTable;
          GridView1.DataSourceID = String.Empty;

      }protected void UpdateRecord(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];

          
            try
            {
                cnx.Open();
                SqlCommand updateCmd = new SqlCommand("UPDATE [Coupon_Info,CouponType] SET [Coupon_Info.RecievingDate]=@date,[CouponType.CouponName]=@Coupon,[Coupon_Info.Serial_Start]=@Start,[Coupon_Info.Serial_End]=@End,[Coupon_Info.Recieved_By]=@By ", cnx);
                updateCmd.CommandType = CommandType.Text;
                updateCmd.Parameters.Add("@date", SqlDbType.Date).Value = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
                updateCmd.Parameters.Add("@Coupon", SqlDbType.NVarChar ,60).Value = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
                updateCmd.Parameters.Add("@Start", SqlDbType.BigInt).Value = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[2].Text);
                updateCmd.Parameters.Add("@End", SqlDbType.BigInt ).Value = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[3].Text);
                updateCmd.Parameters.Add("@By", SqlDbType.NVarChar ,50).Value = ((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
                updateCmd.Connection = cnx;
                cnx.Open();
                updateCmd.ExecuteNonQuery();
                cnx.Close();
            }
            catch (Exception ex)
            {
                ErrorMessage.Text = ex.Message;
            }
            finally  
            {
              //  j
               // updateCmd.Dispose();
               cnx.Close();
                cnx.Dispose();
            }
        }protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
    GridView1.EditIndex =e.NewEditIndex;
    FillVendorGrid();
}
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView1.EditIndex = -1;
        FillVendorGrid();
    }
}

QuestionPOST and GET Method Pin
syaiful_8619-Jul-09 16:14
syaiful_8619-Jul-09 16:14 
AnswerRe: POST and GET Method Pin
Abhijit Jana19-Jul-09 18:09
professionalAbhijit Jana19-Jul-09 18:09 
GeneralRe: POST and GET Method Pin
syaiful_8622-Jul-09 14:28
syaiful_8622-Jul-09 14:28 
Questionhow do put java applet and slideshow in asp.net Pin
ashutosh_karna19-Jul-09 8:10
ashutosh_karna19-Jul-09 8:10 
AnswerRe: how do put java applet and slideshow in asp.net Pin
Abhijit Jana19-Jul-09 8:15
professionalAbhijit Jana19-Jul-09 8:15 
QuestionHow to save webpage to client machine in asp.net Pin
ashutosh_karna19-Jul-09 8:02
ashutosh_karna19-Jul-09 8:02 
AnswerRe: How to save webpage to client machine in asp.net Pin
Abhijit Jana19-Jul-09 8:20
professionalAbhijit Jana19-Jul-09 8:20 
GeneralRe: How to save webpage to client machine in asp.net Pin
ashutosh_karna19-Jul-09 8:32
ashutosh_karna19-Jul-09 8:32 
AnswerRe: How to save webpage to client machine in asp.net Pin
Christian Graus19-Jul-09 14:02
protectorChristian Graus19-Jul-09 14:02 
QuestionCalling Button_click event from Tab key_press event Pin
ashutosh_karna19-Jul-09 7:54
ashutosh_karna19-Jul-09 7:54 
AnswerRe: Calling Button_click event from Tab key_press event Pin
Christian Graus19-Jul-09 15:07
protectorChristian Graus19-Jul-09 15:07 
QuestionRegular Expression For RFC 3986 URI Pin
mj_developer19-Jul-09 4:30
mj_developer19-Jul-09 4:30 
AnswerRe: Regular Expression For RFC 3986 URI Pin
Abhijit Jana19-Jul-09 4:52
professionalAbhijit Jana19-Jul-09 4:52 
QuestionSqlCommands.ExecuteNonQuery always return -1 Pin
vnsraj18-Jul-09 21:30
vnsraj18-Jul-09 21:30 
AnswerRe: SqlCommands.ExecuteNonQuery always return -1 Pin
Parwej Ahamad18-Jul-09 22:25
professionalParwej Ahamad18-Jul-09 22:25 
GeneralRe: SqlCommands.ExecuteNonQuery always return -1 Pin
vnsraj18-Jul-09 23:25
vnsraj18-Jul-09 23:25 
GeneralRe: SqlCommands.ExecuteNonQuery always return -1 Pin
Abhijit Jana19-Jul-09 0:26
professionalAbhijit Jana19-Jul-09 0:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.