Click here to Skip to main content
15,889,116 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: solution n-tiers Pin
Vimalsoft(Pty) Ltd20-Apr-10 5:09
professionalVimalsoft(Pty) Ltd20-Apr-10 5:09 
GeneralRe: solution n-tiers Pin
tek 200920-Apr-10 5:37
tek 200920-Apr-10 5:37 
GeneralRe: solution n-tiers Pin
Vimalsoft(Pty) Ltd20-Apr-10 10:06
professionalVimalsoft(Pty) Ltd20-Apr-10 10:06 
Questionwebconfig size problem Pin
kuyucakli19-Apr-10 1:11
kuyucakli19-Apr-10 1:11 
AnswerRe: webconfig size problem Pin
Dinesh Mani19-Apr-10 1:28
Dinesh Mani19-Apr-10 1:28 
QuestionResponse.redirect problem in IE Pin
surender.m19-Apr-10 0:57
surender.m19-Apr-10 0:57 
AnswerRe: Response.redirect problem in IE Pin
surender.m20-Apr-10 20:20
surender.m20-Apr-10 20:20 
QuestionData not transfering to another page Pin
developerit18-Apr-10 23:16
developerit18-Apr-10 23:16 
iam taking data from one page gridview to another page in session but it is not displaying in another page gridview
please check my code and give suggestion which helps me


string constr = "Data Source=MAINSERVER;Initial Catalog=Inventory;User ID=sa;Password=nsg_ss_0103";<br />
    protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        <br />
<br />
        if (Page.IsPostBack == false)<br />
        {<br />
            GridView1.PageIndex = 0;<br />
<br />
            bindata();<br />
<br />
        }<br />
<br />
<br />
<br />
<br />
<br />
<br />
    }<br />
private void bindata()<br />
    {<br />
<br />
        SqlConnection con12 = new SqlConnection(constr);<br />
        SqlDataAdapter da12 = new SqlDataAdapter("SELECT [CategoryNameE], [ItemKey], [ItemKeyNameE], [CurrentQTY], [SalesPrice] FROM [CurrentInWH]", con12);<br />
        DataSet ds = new DataSet();<br />
        da12.Fill(ds, "t");<br />
        GridView1.DataSource = ds.Tables["t"];<br />
        GridView1.DataBind();<br />
    }<br />
<br />
 private void GetGridViewData()<br />
    {<br />
        DataTable dt;<br />
        if(Session["CheckedRecords"]!=null)<br />
        //if (ViewState["CheckedRecords"] != null)<br />
            dt = (DataTable)Session["CheckedRecords"];<br />
        else<br />
            dt = CreateNewTable();<br />
<br />
        for (int i = 0; i < GridView1.Rows.Count; i++)<br />
        {<br />
            CheckBox chk = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chk");<br />
            if (chk.Checked)<br />
            {<br />
                dt = AddNewRow(GridView1.Rows[i], dt);<br />
            }<br />
            else<br />
            {<br />
                dt = RemoveRow(GridView1.Rows[i], dt);<br />
            }<br />
<br />
        }<br />
        Session["CheckedRecords"] = dt;<br />
        <br />
    }<br />
<br />
 private DataTable CreateNewTable()<br />
    {<br />
        DataTable dt = new DataTable();<br />
        dt.Columns.Add("CategoryNameE");<br />
        dt.Columns.Add("ItemKey");<br />
        dt.Columns.Add("ItemKeyNameE");<br />
        dt.Columns.Add("CurrentQTY");<br />
        dt.Columns.Add("SalesPrice");<br />
        dt.Columns.Add("Quantity");<br />
        dt.Columns.Add("Total");<br />
<br />
        dt.AcceptChanges();<br />
        return dt;<br />
    }<br />
<br />
private DataTable AddNewRow(GridViewRow gvrow, DataTable dt)<br />
    {<br />
        DataRow[] dr = dt.Select("ItemKey = '" + gvrow.Cells[2].Text + "'");<br />
        if (dr.Length <= 0)<br />
        {<br />
            dt.Rows.Add();<br />
            dt.Rows[dt.Rows.Count - 1]["CategoryNameE"] = gvrow.Cells[1].Text;<br />
            dt.Rows[dt.Rows.Count - 1]["ItemKey"] = gvrow.Cells[2].Text;<br />
            dt.Rows[dt.Rows.Count - 1]["ItemKeyNameE"] = gvrow.Cells[3].Text;<br />
            dt.Rows[dt.Rows.Count - 1]["CurrentQTY"] = gvrow.Cells[4].Text;<br />
            dt.Rows[dt.Rows.Count - 1]["SalesPrice"] = gvrow.Cells[5].Text;<br />
            dt.Rows[dt.Rows.Count - 1]["Quantity"] = gvrow.Cells[6].Text;<br />
            dt.Rows[dt.Rows.Count - 1]["Total"] = gvrow.Cells[7].Text;<br />
<br />
<br />
<br />
            dt.AcceptChanges();<br />
        }<br />
        return dt;<br />
    }<br />
<br />
private DataTable RemoveRow(GridViewRow gvrow, DataTable dt)<br />
    {<br />
        DataRow[] dr = dt.Select("ItemKey= '" + gvrow.Cells[2].Text + "'");<br />
        if (dr.Length > 0)<br />
        {<br />
            dt.Rows.Remove(dr[0]);<br />
            dt.AcceptChanges();<br />
        }<br />
        return dt;<br />
    }<br />
<br />
protected void chk_CheckedChanged(object sender, EventArgs e)<br />
    {<br />
        GetGridViewData();<br />
        <br />
        <br />
<br />
        TextBox txtqty1; TextBox txttott; CheckBox ch = null;<br />
        for (int i = 0; i < GridView1.Rows.Count; i++)<br />
        {<br />
<br />
            txtqty1 = (TextBox)GridView1.Rows[i].FindControl("txtqty");<br />
            txttott = (TextBox)GridView1.Rows[i].FindControl("txttot");<br />
            ch = (CheckBox)GridView1.Rows[i].FindControl("chk");<br />
<br />
            if (ch.Checked)<br />
            {<br />
                txtqty1.Visible = true;<br />
                txttott.Visible = true;<br />
            }<br />
            else<br />
            {<br />
<br />
                txtqty1.Visible = false;<br />
                txttott.Visible = false;<br />
<br />
            }<br />
<br />
<br />
<br />
<br />
        }<br />
        <br />
    }<br />
// in second page<br />
DataTable dt = (DataTable)Session["CheckedRecords"];<br />
GridView1.DataSource = dt;<br />
        GridView1.DataBind();<br />
<br />

AnswerRe: Data not transfering to another page Pin
Dinesh Mani19-Apr-10 0:49
Dinesh Mani19-Apr-10 0:49 
AnswerRe: Data not transfering to another page Pin
Tej Aj19-Apr-10 2:19
Tej Aj19-Apr-10 2:19 
QuestionCSS and Specific Word Colouring Pin
Paul Unsworth18-Apr-10 23:13
Paul Unsworth18-Apr-10 23:13 
AnswerRe: CSS and Specific Word Colouring Pin
daveyerwin19-Apr-10 0:29
daveyerwin19-Apr-10 0:29 
GeneralRe: CSS and Specific Word Colouring Pin
Paul Unsworth19-Apr-10 0:31
Paul Unsworth19-Apr-10 0:31 
QuestionHow to import gmail,yahoo, etc. contacts in asp.net Pin
Avinash_Mane18-Apr-10 21:15
Avinash_Mane18-Apr-10 21:15 
AnswerRe: How to import gmail,yahoo, etc. contacts in asp.net Pin
Abhijit Jana18-Apr-10 21:26
professionalAbhijit Jana18-Apr-10 21:26 
GeneralRe: How to import gmail,yahoo, etc. contacts in asp.net Pin
Gaurav Dudeja India18-Apr-10 22:20
Gaurav Dudeja India18-Apr-10 22:20 
GeneralRe: How to import gmail,yahoo, etc. contacts in asp.net Pin
Abhijit Jana18-Apr-10 22:50
professionalAbhijit Jana18-Apr-10 22:50 
GeneralRe: How to import gmail,yahoo, etc. contacts in asp.net Pin
Gaurav Dudeja India18-Apr-10 22:57
Gaurav Dudeja India18-Apr-10 22:57 
QuestionSearcching Pin
dfsdsf4343418-Apr-10 20:59
dfsdsf4343418-Apr-10 20:59 
AnswerRe: Searcching Pin
Abhijit Jana18-Apr-10 21:14
professionalAbhijit Jana18-Apr-10 21:14 
AnswerRe: Searcching Pin
Sandesh M Patil18-Apr-10 23:02
Sandesh M Patil18-Apr-10 23:02 
QuestionImage url getting wrong Pin
Member 438775718-Apr-10 20:24
Member 438775718-Apr-10 20:24 
QuestionRegular Expression for link in vb.net label. Pin
Member 412548018-Apr-10 14:57
Member 412548018-Apr-10 14:57 
AnswerRe: Regular Expression for link in vb.net label. Pin
Not Active18-Apr-10 15:16
mentorNot Active18-Apr-10 15:16 
AnswerRe: Regular Expression for link in vb.net label. Pin
Member 412548018-Apr-10 17:26
Member 412548018-Apr-10 17: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.