Click here to Skip to main content
15,887,683 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Make uploading of file optional?? Pin
F-ES Sitecore13-Oct-15 23:28
professionalF-ES Sitecore13-Oct-15 23:28 
GeneralRe: Make uploading of file optional?? (SOLVED) Pin
samflex27-Oct-15 15:42
samflex27-Oct-15 15:42 
AnswerRe: Make uploading of file optional?? Pin
ZurdoDev15-Oct-15 2:14
professionalZurdoDev15-Oct-15 2:14 
QuestionEcommerce site development Pin
Member 1205587613-Oct-15 8:33
Member 1205587613-Oct-15 8:33 
SuggestionRe: Ecommerce site development Pin
Richard MacCutchan13-Oct-15 9:57
mveRichard MacCutchan13-Oct-15 9:57 
AnswerRe: Ecommerce site development Pin
F-ES Sitecore13-Oct-15 23:42
professionalF-ES Sitecore13-Oct-15 23:42 
QuestionRe: Ecommerce site development Pin
ZurdoDev15-Oct-15 2:15
professionalZurdoDev15-Oct-15 2:15 
QuestionHell All actually we want to make my website fast and i use repeater jquery ajax for get data using store procedure now we want to implement paging concept in this code but still remember our speed will not effect because we want ot fast website Pin
Member 1205134011-Oct-15 21:18
Member 1205134011-Oct-15 21:18 
actually we want to make my website fast and i use repeater jquery, ajax for get data using store procedure now we want to implement paging concept in this code but still remember our speed will not effect because we want fast website
my code is
CS.aspx
XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CS.aspx.cs" Inherits="CS" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        body
        {
            font-family: Arial;
            font-size: 10pt;
        }
        table
        {
            border: 1px solid #ccc;
            border-collapse: collapse;
            background-color: #fff;
            width:200px;
        }
        table th
        {
            background-color: #B8DBFD;
            color: #333;
            font-weight: bold;
        }
        table th, table td
        {
            padding: 5px;
            border: 1px solid #ccc;
        }
        table, table table td
        {
            border: 0px solid #ccc;
        }
    </style>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $.ajax({
                type: "POST",
                url: "CS.aspx/GetCustomers",
                data: '{}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSuccess,
                failure: function (response) {
                    alert(response.d);
                },
                error: function (response) {
                    alert(response.d);
                }
            });
        });

        function OnSuccess(response) {
            var xmlDoc = $.parseXML(response.d);
            var xml = $(xmlDoc);
            var customers = xml.find("Table");
            var table = $("#dvCustomers table").eq(0).clone(true);
            $("#dvCustomers table").eq(0).remove();
            customers.each(function () {
                var customer = $(this);
                $(".name", table).html(customer.find("compid").text());
                $(".city", table).html(customer.find("Compdate").text());
                $(".postal", table).html(customer.find("name").text());
                $(".country", table).html(customer.find("phone").text());
                $(".phone", table).html(customer.find("subdepartnm").text());
                $(".fax", table).html(customer.find("block").text());
                $("#dvCustomers").append(table).append("<br />");
                table = $("#dvCustomers table").eq(0).clone(true);
            });
        }
    </script>

</head>
<body style="font-family: Arial; font-size: 10pt">
    <form id="form1" runat="server">
    <div id="dvCustomers">
        <asp:Repeater ID="rptCustomers" runat="server">
            <ItemTemplate>
                <table class="tblCustomer" cellpadding="2" cellspacing="0" border="1">
                   <tr>
                        <th>
                            <b><u><span class="name">
                                <%# Eval("compid")%></span></u></b>
                        </th>
                    </tr>
                    <tr>
                        <td>
                            <b>Complain Date: </b><span class="city"><%# Eval("Compdate")%></span><br />
                            <b>Name: </b><span class="postal"><%# Eval("name")%></span><br />
                            <b>Phone: </b><span class="country"><%# Eval("phone")%></span><br />
                            <b>Department: </b><span class="phone"><%# Eval("subdepartnm")%></span><br />
                            <b>Block: </b><span class="fax"><%# Eval("block")%></span><br />
                        </td>
                    </tr>
                </table>
            </ItemTemplate>
        </asp:Repeater>
    </div>
    </form>
</body>
</html

>

CS.aspx.cs code
using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.Services;

public partial class CS : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.BindDummyItem();
}
}

private void BindDummyItem()
{
DataTable dummy = new DataTable();
dummy.Columns.Add("compid");
dummy.Columns.Add("Compdate");
dummy.Columns.Add("name");
dummy.Columns.Add("phone");
dummy.Columns.Add("subdepartnm");
dummy.Columns.Add("block");
//dummy.Columns.Add("Fax");
dummy.Rows.Add();
rptCustomers.DataSource = dummy;
rptCustomers.DataBind();
}


[WebMethod]
public static string GetCustomers()
{
DataTable dt = new DataTable();
SqlCommand cmd = null;
SqlDataAdapter adp = null;
string constr = ConfigurationManager.ConnectionStrings["SERVERNAME"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
//string constr = ConfigurationManager.ConnectionStrings["SERVERNAME"].ConnectionString;
cmd = new SqlCommand("sp_Closed", con);
cmd.Parameters.Add("@OfficerId", SqlDbType.BigInt).Value = 1344;
cmd.CommandType = CommandType.StoredProcedure;
//adp = new SqlDataAdapter(cmd);
//adp.Fill(dt);
//rptCustomers.DataSource = dt;
//rptCustomers.DataBind();
//string query = "SELECT TOP 10 * FROM Customers";
//SqlCommand cmd = new SqlCommand(query);
return GetData(cmd).GetXml();
}

private static DataSet GetData(SqlCommand cmd)
{
string constr = ConfigurationManager.ConnectionStrings["SERVERNAME"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataSet ds = new DataSet())
{
sda.Fill(ds);
return ds;
}
}
}
}
}
QuestionRe: Hell All actually we want to make my website fast and i use repeater jquery ajax for get data using store procedure now we want to implement paging concept in this code but still remember our speed will not effect because we want ot fast website Pin
ZurdoDev13-Oct-15 2:23
professionalZurdoDev13-Oct-15 2:23 
Questionissue with accessing asp.net app over WAN Pin
Member 1191972211-Oct-15 20:27
Member 1191972211-Oct-15 20:27 
RantRe: issue with accessing asp.net app over WAN Pin
Richard Deeming12-Oct-15 1:45
mveRichard Deeming12-Oct-15 1:45 
GeneralRe: issue with accessing asp.net app over WAN Pin
Member 1191972212-Oct-15 18:37
Member 1191972212-Oct-15 18:37 
GeneralRe: issue with accessing asp.net app over WAN Pin
Richard Deeming13-Oct-15 1:40
mveRichard Deeming13-Oct-15 1:40 
GeneralRe: issue with accessing asp.net app over WAN Pin
Member 1191972213-Oct-15 18:29
Member 1191972213-Oct-15 18:29 
GeneralRe: issue with accessing asp.net app over WAN Pin
Richard Deeming14-Oct-15 1:57
mveRichard Deeming14-Oct-15 1:57 
QuestionTime line for Work Completion for Asp.net C# and SqlServer DB Pin
macca249-Oct-15 1:23
macca249-Oct-15 1:23 
AnswerRe: Time line for Work Completion for Asp.net C# and SqlServer DB Pin
Richard Deeming9-Oct-15 2:25
mveRichard Deeming9-Oct-15 2:25 
AnswerRe: Time line for Work Completion for Asp.net C# and SqlServer DB Pin
jkirkerx9-Oct-15 9:51
professionaljkirkerx9-Oct-15 9:51 
GeneralRe: Time line for Work Completion for Asp.net C# and SqlServer DB Pin
macca2413-Oct-15 0:58
macca2413-Oct-15 0:58 
QuestionRead Invoice number from pdf file Pin
Praveen Kandari8-Oct-15 22:35
Praveen Kandari8-Oct-15 22:35 
AnswerRe: Read Invoice number from pdf file Pin
ZurdoDev13-Oct-15 2:24
professionalZurdoDev13-Oct-15 2:24 
GeneralRe: Read Invoice number from pdf file Pin
Praveen Kandari15-Oct-15 1:36
Praveen Kandari15-Oct-15 1:36 
GeneralRe: Read Invoice number from pdf file Pin
ZurdoDev15-Oct-15 1:41
professionalZurdoDev15-Oct-15 1:41 
QuestionAsp.net Rapid Development Pin
macca248-Oct-15 3:38
macca248-Oct-15 3:38 
Questionissue in unifying domain.com with www.domain.com using 301 redirect Pin
9pagod7-Oct-15 5:23
9pagod7-Oct-15 5:23 

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.