|
Thanks mark for the reply.
There is a behavior difference between ASP.NET 1.1 and 2.0: If you have a control on a page that is marked Read-Only and EnableViewState is set to false on the Page, the ReadOnly value will no longer post back in ASP.NET 2.0 - the value gets lost. This even though the value is actually returned in the POST buffer.
But if you run the same with aspnet 1.1 it works fine.
Any help would be appreciated.
regards
surender
No Defeat Is Final Until You Stop Trying!.......
|
|
|
|
|
Don't you think it would have been important to include these details in the original post? You first only said a property, no mention of a control and postback.
However, since you have already quoted this[^] site, then implement the fix.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks for the reply Mark.
I hav gone through that link before here my concern is i do not want to change the Application code to fix the issue, bt i want that application to be run on aspnet 1.1 mode, how i can achieve this on 64 bit machine.
regards,
surender
No Defeat Is Final Until You Stop Trying!.......
|
|
|
|
|
surender.m wrote: i do not want to change the Application code to fix the issue
Then wait for Microsoft to fix the issue, though I suspect hell will freeze over long before that.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi Mark,
I had changed my Application code, now its working fine.
Is there a way to run both aspnet 1.1 and aspnet 2.0 on IIS of a 64 bit machine?
Regards,
surender
No Defeat Is Final Until You Stop Trying!.......
|
|
|
|
|
The two frameworks can run side by side. You can use IIS to specifiy which version handles requests for a particular web application.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
i have 2 columns in dataview, i want to populate MSChart with Type as StackedColumn and both columns on one over another.
|
|
|
|
|
Hi,
This is from Chandrakanth.
i have one problem with update panel in Ajax
in aspx page div tag is there. In that some controls are there.
i kept that div tag in the Update Panel to avoid post back by Asp:Image button click event.
I am using Asp:ImageButton. When i click on that image button client side code that is Javascript code should work as well as c# code should works.
problem is when i click on that Asp:ImageButton, post back is happening for DIV Tag. I want to avoid that post back of DIV tag. How can i avoid that.
<asp:imagebutton id="imgbutton" runat="server" onclick="GetLinkButtonTest"
onclientclick="javascript: SwitchMenus();"
imageurl="~/images/green_globe_refresh_601.jpg" height="32px"
width="31px">
Please help me out from this problem.
Thanks and Regards
Chandrakanth
|
|
|
|
|
OnClientClick='javascript: SwitchMenus(); return false;'
|
|
|
|
|
Hi,
Once again from Chandrakanth. if i use that code , Only Javascript code is working.But C# code is not working which was mention on onclick event.
any suggestions for this.
Thanks and Regards
Chandrakanth
|
|
|
|
|
I'm understanding that you have an imagebutton and a
div with some other controls within an updatepanel.
When you click your imagebutton, you want client and server-side
code to run but not update the contents of your updatepanel?
First, set the updatemode of your updatepanel to "conditional".
then, either place the imagebutton outside that panel (maybe into another updatepanel) or add this to your update-panel-markup:
ChildrenAsTriggers="false"
This prevents the updatepanel from updating its content if the imagebutton is clicked.
If you set ChildrenAsTriggers="false" , you can still add specific
triggers to the triggers-section of the updatepanel-markup.
Use UpdatePanelName.Update() to update the contents from server-side.
Good Luck
|
|
|
|
|
Hi,
Once again from Chandrakanth.
Thanks for prompt reply.
Problem is when i click on Image button, CLIENT SIDE CODE is executing, next POST BACK is happening, C# CODE is executing.
Actually my problem is i want to avoid that POST BACK when i click on ASP:IMAGE BUTTON.
Any suggestion please............
Thanks and Regards
Chandrakanth
|
|
|
|
|
To Prevent the postback, you can return false in your clientscript - but this prevents the server-side-code from running.
You cannot simply avoid that postback. This means, you cannot simply
use the clientside AND SERVER-SIDE on-click events without a postback.
You can limit the effects this postback has by using updatepanels
and (if!ispostback..) code-blocks in your server-side code. You can also figure out, which control raised the postback.
BUT -
Maybe this is a solution to your problem? -
Hope this helps
|
|
|
|
|
hi iam using asp.net with c#, my grid contains 1st column is check box ,and paging is true ,iam displaying data from view that does not contain primary key, so based on this when user selects the no of checkboxes in 1st page and
in another page some records then i want to transfer to another page gridview but it is not displaying. can you correct my code where iam going wrong
string constr = "Data Source=MAINSERVER;Initial Catalog=Inventory;User ID=sa;Password=nsg";
protected void Page_Load(object sender, EventArgs e)
{
if(Page.IsPostBack==false)
{
GridView1.PageIndex = 0;
bindata();
}
}
private void bindata()
{
SqlConnection con12 = new SqlConnection(constr);
SqlDataAdapter da12 = new SqlDataAdapter("SELECT [CategoryNameE], [ItemKey], [ItemKeyNameE], [CurrentQTY], [SalesPrice] FROM [CurrentInWH]", con12);
DataSet ds = new DataSet();
da12.Fill(ds,"t");
GridView1.DataSource = ds.Tables["t"];
GridView1.DataBind();
}
private void GetGridViewData()
{
DataTable dt;
if (ViewState["CheckedRecords"] != null)
dt = (DataTable)ViewState["CheckedRecords"];
else
dt = CreateNewTable();
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox chk = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chk");
if (chk.Checked)
{
dt = AddNewRow(GridView1.Rows[i], dt);
}
else
{
dt = RemoveRow(GridView1.Rows[i], dt);
}
}
ViewState["CheckedRecords"] = dt;
}
private DataTable CreateNewTable()
{
DataTable dt = new DataTable();
dt.Columns.Add("CategoryNameE");
dt.Columns.Add("ItemKey");
dt.Columns.Add("ItemKeyNameE");
dt.Columns.Add("CurrentQTY");
dt.Columns.Add("SalesPrice");
dt.Columns.Add("Quantity");
dt.Columns.Add("Total");
dt.AcceptChanges();
return dt;
}
private DataTable AddNewRow(GridViewRow gvRow, DataTable dt)
{
DataRow[] dr = dt.Select("CustomerID = '" + gvRow.Cells[1].Text + "'");
if (dr.Length <= 0)
{
dt.Rows.Add();
dt.Rows[dt.Rows.Count - 1]["CategoryNameE"] = gvRow.Cells[1].Text;
dt.Rows[dt.Rows.Count - 1]["ItemKey"] = gvRow.Cells[2].Text;
dt.Rows[dt.Rows.Count - 1]["ItemKeyNameE"] = gvRow.Cells[3].Text;
dt.Rows[dt.Rows.Count - 1]["CurrentQTY"] = gvRow.Cells[4].Text;
dt.Rows[dt.Rows.Count - 1]["SalesPrice"] = gvRow.Cells[5].Text;
dt.Rows[dt.Rows.Count - 1]["Quantity"] = gvRow.Cells[6].Text;
dt.Rows[dt.Rows.Count - 1]["Total"] = gvRow.Cells[7].Text;
dt.AcceptChanges();
}
return dt;
}
private DataTable RemoveRow(GridViewRow gvRow, DataTable dt)
{
DataRow[] dr = dt.Select("CategoryNameE= '" + gvRow.Cells[1].Text + "'");
if (dr.Length > 0)
{
dt.Rows.Remove(dr[0]);
dt.AcceptChanges();
}
return dt;
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GetGridViewData();
GridView1.PageIndex = e.NewPageIndex;
bindata();
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox c1 = (CheckBox)row.FindControl("chk");
TextBox qt = (TextBox)row.FindControl("txtqty");
TextBox tot1 = (TextBox)row.FindControl("txttot");
Label categoryname = (Label)row.FindControl("Label5");
Label ItemKey = (Label)row.FindControl("Label2");
Label ItemKeyNameE = (Label)row.FindControl("Label1");
Label CurrentQTY = (Label)row.FindControl("Label3");
Label SalesPrice = (Label)row.FindControl("Label4");
if (c1.Checked == true)
{
clsdataset.insert(categoryname.Text, ItemKey.Text, ItemKeyNameE.Text, CurrentQTY.Text, SalesPrice.Text, qt.Text, tot1.Text);
}
}
}
protected void GridView1_PageIndexChanged(object sender, EventArgs e)
{
GetGridViewData();
}
protected void chk_CheckedChanged(object sender, EventArgs e)
{
GetGridViewData();
TextBox txtqty1;TextBox txttott;CheckBox ch=null;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
txtqty1 = (TextBox)GridView1.Rows[i].FindControl("txtqty");
txttott = (TextBox)GridView1.Rows[i].FindControl("txttot");
ch=(CheckBox)GridView1.Rows[i].FindControl("chk");
if (ch.Checked)
{
txtqty1.Visible = true;
txttott.Visible = true;
}
else {
txtqty1.Visible = false;
txttott.Visible = false;
}
}
this is insertbutton code
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox c1 = (CheckBox)row.FindControl("chk");
TextBox qt = (TextBox)row.FindControl("txtqty");
TextBox tot1 = (TextBox)row.FindControl("txttot");
Label categoryname = (Label)row.FindControl("Label5");
Label ItemKey = (Label)row.FindControl("Label2");
Label ItemKeyNameE = (Label)row.FindControl("Label1");
Label CurrentQTY = (Label)row.FindControl("Label3");
Label SalesPrice = (Label)row.FindControl("Label4");
if (c1.Checked == true)
{
clsdataset.insert(categoryname.Text, ItemKey.Text, ItemKeyNameE.Text, CurrentQTY.Text, SalesPrice.Text, qt.Text, tot1.Text);
}
}
iam performing this operation inbutton1 for saving all records but it is not storing previous records
|
|
|
|
|
hi iam using asp.net with c#, my grid contains 1st column is check box ,and paging is true ,iam displaying data from view that does not contain primary key, so based on this when user selects the no of checkboxes in 1st page and
in another page some records then i want to transfer to another page gridview but it is not displaying. can you correct my code where iam going wrong
string constr = "Data Source=MAINSERVER;Initial Catalog=Inventory;User ID=sa;Password=nsg";
protected void Page_Load(object sender, EventArgs e)
{
if(Page.IsPostBack==false)
{
GridView1.PageIndex = 0;
bindata();
}
}
private void bindata()
{
SqlConnection con12 = new SqlConnection(constr);
SqlDataAdapter da12 = new SqlDataAdapter("SELECT [CategoryNameE], [ItemKey], [ItemKeyNameE], [CurrentQTY], [SalesPrice] FROM [CurrentInWH]", con12);
DataSet ds = new DataSet();
da12.Fill(ds,"t");
GridView1.DataSource = ds.Tables["t"];
GridView1.DataBind();
}
private void GetGridViewData()
{
DataTable dt;
if (ViewState["CheckedRecords"] != null)
dt = (DataTable)ViewState["CheckedRecords"];
else
dt = CreateNewTable();
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox chk = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chk");
if (chk.Checked)
{
dt = AddNewRow(GridView1.Rows[i], dt);
}
else
{
dt = RemoveRow(GridView1.Rows[i], dt);
}
}
ViewState["CheckedRecords"] = dt;
}
//@CategoryNameE,@ItemKey,@ItemKeyNameE,@CurrentQTY,@SalesPrice,@Quantity,@Total
private DataTable CreateNewTable()
{
DataTable dt = new DataTable();
dt.Columns.Add("CategoryNameE");
dt.Columns.Add("ItemKey");
dt.Columns.Add("ItemKeyNameE");
dt.Columns.Add("CurrentQTY");
dt.Columns.Add("SalesPrice");
dt.Columns.Add("Quantity");
dt.Columns.Add("Total");
dt.AcceptChanges();
return dt;
}
private DataTable AddNewRow(GridViewRow gvRow, DataTable dt)
{
DataRow[] dr = dt.Select("CustomerID = '" + gvRow.Cells[1].Text + "'");
if (dr.Length <= 0)
{
dt.Rows.Add();
dt.Rows[dt.Rows.Count - 1]["CategoryNameE"] = gvRow.Cells[1].Text;
dt.Rows[dt.Rows.Count - 1]["ItemKey"] = gvRow.Cells[2].Text;
dt.Rows[dt.Rows.Count - 1]["ItemKeyNameE"] = gvRow.Cells[3].Text;
dt.Rows[dt.Rows.Count - 1]["CurrentQTY"] = gvRow.Cells[4].Text;
dt.Rows[dt.Rows.Count - 1]["SalesPrice"] = gvRow.Cells[5].Text;
dt.Rows[dt.Rows.Count - 1]["Quantity"] = gvRow.Cells[6].Text;
dt.Rows[dt.Rows.Count - 1]["Total"] = gvRow.Cells[7].Text;
dt.AcceptChanges();
}
return dt;
}
private DataTable RemoveRow(GridViewRow gvRow, DataTable dt)
{
DataRow[] dr = dt.Select("CategoryNameE= '" + gvRow.Cells[1].Text + "'");
if (dr.Length > 0)
{
dt.Rows.Remove(dr[0]);
dt.AcceptChanges();
}
return dt;
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GetGridViewData();
GridView1.PageIndex = e.NewPageIndex;
bindata();
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox c1 = (CheckBox)row.FindControl("chk");
TextBox qt = (TextBox)row.FindControl("txtqty");
TextBox tot1 = (TextBox)row.FindControl("txttot");
Label categoryname = (Label)row.FindControl("Label5");
Label ItemKey = (Label)row.FindControl("Label2");
Label ItemKeyNameE = (Label)row.FindControl("Label1");
Label CurrentQTY = (Label)row.FindControl("Label3");
Label SalesPrice = (Label)row.FindControl("Label4");
if (c1.Checked == true)
{
clsdataset.insert(categoryname.Text, ItemKey.Text, ItemKeyNameE.Text, CurrentQTY.Text, SalesPrice.Text, qt.Text, tot1.Text);
}
}
}
protected void GridView1_PageIndexChanged(object sender, EventArgs e)
{
GetGridViewData();
}
protected void chk_CheckedChanged(object sender, EventArgs e)
{
GetGridViewData();
TextBox txtqty1;TextBox txttott;CheckBox ch=null;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
txtqty1 = (TextBox)GridView1.Rows[i].FindControl("txtqty");
txttott = (TextBox)GridView1.Rows[i].FindControl("txttot");
ch=(CheckBox)GridView1.Rows[i].FindControl("chk");
if (ch.Checked)
{
txtqty1.Visible = true;
txttott.Visible = true;
}
else {
txtqty1.Visible = false;
txttott.Visible = false;
}
}
this is insertbutton code
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox c1 = (CheckBox)row.FindControl("chk");
TextBox qt = (TextBox)row.FindControl("txtqty");
TextBox tot1 = (TextBox)row.FindControl("txttot");
Label categoryname = (Label)row.FindControl("Label5");
Label ItemKey = (Label)row.FindControl("Label2");
Label ItemKeyNameE = (Label)row.FindControl("Label1");
Label CurrentQTY = (Label)row.FindControl("Label3");
Label SalesPrice = (Label)row.FindControl("Label4");
if (c1.Checked == true)
{
clsdataset.insert(categoryname.Text, ItemKey.Text, ItemKeyNameE.Text, CurrentQTY.Text, SalesPrice.Text, qt.Text, tot1.Text);
}
}
iam performing this operation inbutton1 for saving all records but it is not storing previous records
|
|
|
|
|
See next question answer....
|
|
|
|
|
1. Include your code in pre tags.
2. IMO, the inclusion of "GetGridViewData()" method in each & every event is creating problem. See if it works by removing that method from PageIndexChanging or Changed event.
|
|
|
|
|
Hi all,
I am developing an application with C # and ASP. I displays information in a GridView and I want to get my data select another GridView that is in another asp page.
I sought to know how do you fill the 2nd GridView. I think it must work with a query string, if someone can help me in this direction.
Thank you.
|
|
|
|
|
Use Session with Dataset/DataTable objects.
1st Page,
DataTable dtEmp = new DataTable();
Session["EmpData"] = dtEmp;
2nd Page,
DataTable dtResultEmp = new DataTable();
dtResultEmp = (DataTable)Session["EmpData"];
Now you can bind the Data to our 2nd Gridview on 2nd page.
|
|
|
|
|
iam also facing the same problem
in my gridview 1st colum is check box, then what ever user selects the checkboxes that data i have to transfer to next page grid
can you give example how to take all data in session or datatable
|
|
|
|
|
You need to loop through all rows of gridview.
Find those rows whose checkbox is checked, fill those records in a datatable.
Assign that datatable to a Session Variable as mentioned above.
Retrieve that session variable to a datatable on next page, as mentioned above.
Assign datatable of next page as datasource of 2nd gridview.
|
|
|
|
|
hi, i need while looping how to add to data table can you give some example which helps me
|
|
|
|
|
Your code is ok, just see the advice i have given in your original post.
|
|
|
|
|
if you can explain more this solution I can not apply, thank you
|
|
|
|
|
thatraja please, if you can detail your answer, I don't understand very well
|
|
|
|
|