|
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
|
|
|
|
|
I just noticed that the latest version of ASP.NET MVC has just been released. I have been developing in ASP.NET for over 6 years now, my question is why should i move to MVC, What are the advantages and how about the learning curve?
For those who are using it.. is it worth the investment in learning and using it?
What should i watch out for?
Can anyone help..
|
|
|
|
|
You should really google for this question. You will find A LOT of pros/cons lists and comparisons.
I especially recommend the video-sessions from scott hanselman. E.g.:
http://www.hanselman.com/blog/CategoryView.aspx?category=Channel9
You learn a lot and the presentation style keeps you awake easily.
Often mentioned pros/cons:
Pros:
- Clear seperation of concerns / architecture
- Programming the web as it's ment to be (there's no view-state imitating a stateful environment)
- Programming the web is suddenly more fun - no weird event-handling / viewstate
- Easy understandable conventions - less configuration.
- Powerful architecture and tools to reuse components/views
- Better support of unit-testing
- Powerful Tools help you create CRUD-Szenarios with amazing speed
-...
Cons:
- New concepts to learn, some are difficult to get used to for traditional webform-developers
- Rich webform UI controls can ususally not be used in MVC - and therefor have to be replaced somehow
- ...
I would go the following way:
- Learn the basics, whether you're planning on using MVC or not. Then you have
a good start to decide if it will help you in the future (or not). This knowledge is definitely not wasted.
- Have a look at the nerddinner-application from hanselman
Hope this helps at least a bit
|
|
|
|
|
Hi All,
when i am query from the data base i am getting Date in the following format
01-01-2010
but i want to display it in 01 - jan - 2010
how to this can any one help me.
Thanks and regards,
Amit Patel
|
|
|
|
|
For asp.net use <datetime>.ToString() with the suitable formatter from here .
And for MS SQL use Convert() function like here.
|
|
|
|
|