|
|
Hi,
I am having datagrid in which data is coming.Suppose we have three rows in the datagrid.Each row is having a checkbox.In each row we have five columns. One of them is "QTY" which is having a textbox as a templte column.Below the grid we have a "update" button.Suppose in the original state quantity is "1".And the user changes it to "4" and presses the update button.Then the row should be modified having quantity "4".
What I have done is:
protected void BtnUpdate_Click(object sender, EventArgs e)
{
dt = (DataTable)Session["Cart"];
CheckBox chkSelected = new CheckBox();
foreach (DataGridItem dgItem in DataGrid2.Items)
{
chkSelected = (CheckBox)dgItem.FindControl("chkSelection");
if (chkSelected.Checked == true)
{
TextBox TxtQTY = (TextBox)dgItem.Cells[2].FindControl("TxtQTY");
int Txt2 = Convert.ToInt32(TxtQTY.Text);
Label lblProduct_Id = (Label)dgItem.Cells[0].FindControl("lblProduct_Id");
string id2 = lblProduct_Id.Text;
Label lblDescription = (Label)dgItem.Cells[1].FindControl("lblDescription");
string desc2 = lblDescription.Text;
Label lblPrice = (Label)dgItem.Cells[3].FindControl("lblPrice");
float price2 = Convert.ToSingle(lblPrice.Text);
Label lblCost = (Label)dgItem.Cells[3].FindControl("lblCost");
float cost2 = Convert.ToSingle(lblCost.Text);
float final_cost = price2 * Txt2;
DataRow myrow = dt.NewRow();
myrow["REF"] = id2;
myrow["Description"] = desc2;
myrow["QTY"] = Txt2;
myrow["Price"] = price2;
myrow["Cost"] = final_cost;
dt.Rows.Add(myrow);
dt.AcceptChanges();
Session["data"] = dt;
}
}
DataGrid2.DataSource = dt;
DataGrid2.DataBind();
}
But when I am pressing the update button it is updating the row but it is also showing the previous row.
I am trying to get the index of the row which is checked by the user to update.And then I will delete that row.
But I am unable to do this.
Help me out ...
Thanx in advance.
cheers,
sneha
|
|
|
|
|
Dear,
First, this is the wrong board, DataGrid is desktop control, why you asking about it in ASP.NET board.
Second, I see that you send the same question about 10 times, and somebody sent you answers on the C# board
Third, I think you have to make use of MSDN, or read some books first
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Mohammed Gouda wrote: DataGrid is desktop control
Click[^]
|
|
|
|
|
Hi Sneha ,
Instead of writing the following code:
foreach (DataGridItem dgItem in DataGrid2.Items)
{
chkSelected = (CheckBox)dgItem.FindControl("chkSelection");
if (chkSelected.Checked == true)
{
Write the code written below:
foreach (GridViewRow gr in DataGrid2.Rows)
{
if (((CheckBox)gr.FindControl("chkSelection")).Checked == true)
{
-----Have A Nice Day-----
|
|
|
|
|
Hi,
When it is said to wrap a control with something else. what does it mean?
Best wishes
|
|
|
|
|
Wrapper means a control is used as a component of another control, so that it can behave the same way but have extra functions within it.
Abhishek Sur
|
|
|
|
|
if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
I am using the above code to download files listed in a listbox control
I am placing the listbox in WebPartZone to enable the client to change the page layout, also I put it in an AJAX UpdatePanel to disable postbacks
When I use ONLY the UpdatePanel, it works well
When I use ONLY the WebPartZone, it works well
When I use both together, I get an exception saying:
Sys.WebForms.PageRequestManagerParseErrorException: The message received from the server could not be parsed.Common causes for this error are when the response modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near 'MZ'.
foreach(Minute m in MyLife)
myExperience++;
modified on Thursday, January 22, 2009 2:49 AM
|
|
|
|
|
|
Hi friends i need coding . i have to send invitation to join the website for my site .suppose in gmail or yahoo there is option for invitation .there is option when we fill the mail id it automatically send the link to the reciever
modified on Thursday, January 22, 2009 2:13 AM
|
|
|
|
|
You just need to send mails buddy... that is not a big deal. If you dont have your smtp server, use gmail either.
Gmail gives support to send mails.
Abhishek Sur
|
|
|
|
|
.... and while send mail , you can send a link with user name and other information to validate that user. When user click on that link, simple redirect to particular page and validate the query string , that user is valid or not.
|
|
|
|
|
sir
i am student of MSC-IT.
i do project in NIC.
i want to store exel sheet into SQL database.
so sir help me
how can i convert exel data into SQL database.
send me ans as early as possible.
thank you.
|
|
|
|
|
u can search this issue from google.com
see these links: "http://www.biztalkgurus.com/forums/t/5813.aspx
"http://www.dotnetspider.com/forum/149880-Insert-Excel-Sql-Database-for-asp-net.aspx
hope it helps
|
|
|
|
|
What you need, do you need the excel data only, or the excel file totally,
If you need the data, you can open an OleDb connection with
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=filePath;Extended Properties="Excel 8.0;HDR=YES;IMEX=1";
Then you can select from Sheets
using Select * from [Sheet1$]
Hope this helps. If you still have problems, I can help you with codes too...
Abhishek Sur
|
|
|
|
|
|
My problem is file uploading is failed when website is published otherwise its working fine
I am using IIS 5.0 and ASP.net 3.5 in Visual Studio 2008
For attatching file i am using a seperate popup window and saveing posted file in session variable
Session["postedFile"] = uploadFile.PostedFile; // HttpPostedFile from FileUpload control
Uploading is done from another page.
Is it can be done in better way?
Please help
Regards
Radhakrishnan G.
|
|
|
|
|
Why do you use Session to store files.... It is the highest possiblity of the user to upload a large file and eat up all the memory of the server..
Think it will be better to write in disk rather than using memory for file upload.
Abhishek Sur
|
|
|
|
|
Thanks for the reply.
Yes thats good idea.
I shall keep these attatched files in the Temperory folder of the server
after the processing and uploading I will remove this files..
|
|
|
|
|
Hi,
I have to call a Java Web Service from a .Net Client .I'm using VS2008 (.net 3.5).
Web service was developed with Java. It is installed on a Tomcat server.
The web service offers some methods. A group of methods returns a xml file and a xml attachment.
A group of methods accepts a xml file and a file attachment.
How can I manage this situation ?
I saw different articles and documentation pages.
What's the best strategy ?
I read something about create a VS2005 project with WSE 3.0 and import it in VS2008.
I found notes about WCF ( I don't know WCF . It's the right tool ? ).
I tried a solution like this :
http://blogs.msdn.com/bursteg/archive/2008/07/19/how-to-call-a-java-ee-web-service-from-a-net-client.aspx
I tested article's code. It seems that is no way to manage attachment ...
When I invoked a method I saw this error . "The content type application/dime of the response
message does not match the content type of the binding (text/xml; charset=utf-8).
If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.".
My custom code ( more or less)
WebApp.MyReference.WSMethodClient myMethod = newWebApp.MyReference.WSMethodClient();
// return a xml string and a attachment to soap message. I get xml string , but how can get attachment ?
string l_var = myMethod.service( p_CodApplication, p_UserName, p_Password );
How can I manage the attachment ? How can I manage soap messages with VS2008 ?
Could you help me ?
|
|
|
|
|
Pick one forum and stick with it. Don't cross post just because you don't receive an answer immediately.
only two letters away from being an asset
|
|
|
|
|
Ok ! I'm sorry. I wasn't sure about the right forum ...
|
|
|
|
|
Hi,
I have two Forms in my web application using c#.
Form1:
Opens a folder and checks for latest file (ex: Text1.txt)
Increments the number by 1 and creates a new text file with new number (ex: Text2.txt)
Form2:
Opens new file (ex Text2.txt) and reads line by line and writes to Form
Every time the page is submitted, a new text file is created, so I made the number assigned to the text file an integer and assigned the file name using the following code:
StreamWriter sw;
sw=File.CreateText(@"C:\Desktop\Text" +x +".txt");
sw.Close();
I am having a problem passing the exact file name from Form 1 to Form 2. I want the file to be created on the button click in form 1 but it must be open and read in the timer of form2.
Please help if you can, especially with code examples. I'm completely stuck!
Thanks
|
|
|
|
|
What exactly are you having difficulties with? What have you tried.
Terick wrote: especially with code examples
The people most likely to give you the proper answer will not give you the code without seeing that you are trying yourself first.
only two letters away from being an asset
|
|
|
|
|
if this is a web application then why you are using c:\ .... it should be ~\\Files\\xxx.
to pass data between web forms there are many ways. but you can use Session.
in Form 1 at the Button Click.
StreamWriter sw;
string TextFile = @"C:\Desktop\Text" +x +".txt"
sw=File.CreateText(TextFile);
StreamWriter sw;
Session["TextFile"] = TextFile;
and in Form 2 Page_Load
string TextFile = (string) Session["TextFile"];
but still you need to read more about Session and File Handling.
|
|
|
|