|
Create a container table or div and make it center aligned
|
|
|
|
|
Hi guys,
i have an doubt in Asp.net webservice. I have 2 different web services and inserting the data in 2 different databases.
Web services calling from "Button_click" event in the web page. Once clicked means, the first web service is called and inserting the data to DB. If success,then call 2nd Web service WebMethod.The 2nd Web service web method fails means ,then i want to roll back the first web service transactions.
How to achieve this? how to maintain the transactions across the web service.
Thanks & Regards
d.sengottuvelu
|
|
|
|
|
In this instance i would suggest that if you have control over the code of first web service called that you perform the call to the second service in there. Without programming in a rollback feature into the first web service i doubt you will be able to achieve this while keeping the two services seperate.
|
|
|
|
|
Thank you Hatchard for your reply.
I dont know is it possible or not. I have a requirement like this, thats y i am asking a doubt. Is it possible to maintain the transaction in the webform of calling two web services.
d.sengottuvelu
|
|
|
|
|
|
Thank you Deepak for your reply.
Already i read the mentioned URL tutorial. This explained within the web service
maintain the transaction. In my case, i am calling the two web services in the button_click event.
is there is any possible way to maintain the transaction or alternate method?
d.sengottuvelu
|
|
|
|
|
how to put tooltip on the datagrid column header and also on cell of that column using vb.net 2003? plz help if anyone knows.here datagrid is bound at runtime.
|
|
|
|
|
|
Hi,
You can assign tooltop to header and cell of the datagrid at runtime using ItemDataBound event of datagrid.
void dg_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType = ListItemType.Header)
{
e.Item.ToolTip = "tooltip";
e.Item.Cells[0].ToolTip = "toolTip";
}
}
Above code is in C# so apply vb syntax to implement.
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
hi, first time poster, long time admirer of this site.
Help!
im using Visual Web Developer and i have a page with a couple of data controls on. I would like to use the ClientQueryString to determine what data is displayed on the page.
please advise how to or alternative methods
thanks in advance
|
|
|
|
|
|
I am using a datagrid to show a set of records.
I am also using edit,update,cancel and delete button columns to perfom required action.
I wanted to is it possible for me to call a javascript function on clicking update button in datagrid.
Thanks & Regards
Bhanu
|
|
|
|
|
You will have to use Ajax if you want to use Javascript for this functionality of Datagrid.
Writing client side code for these kind of functinality is not always the best practice.
|
|
|
|
|
bhanu12345 wrote: I wanted to is it possible for me to call a javascript function on clicking update button in datagrid.
It is not a good practice.
Go with Ajax. that will be better for this.
Regards,
Satips.
|
|
|
|
|
Hi,
I am getting an error while uploading and deleting a file in the server. Using the following code.
ERROR MESSAGE: The process cannot access the file 'index_01.jpg' because it is being used by another process.
protected void Button4_Click(object sender, EventArgs e)
{
DirectoryInfo d = new DirectoryInfo(Server.MapPath("~\\Upload\\"));
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(@"D:\\Dotnet_Projects\\kyc_start\\Upload\\" + FileUpload1.FileName);
}
else
{
Label1.Text = "No File Uploaded.";
}
foreach (FileInfo f in d.GetFiles("*.jpg"))
{
byte[] buffer = new byte[f.OpenRead().Length];
f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);
PhotoManager.AddPhoto(buffer);
f.Delete(); //ERROR HERE!!!
}
this.PhID();
}
Plz let me know where i am making mistakes. ITS working fine in local server.
Regards,
dhulipudi
|
|
|
|
|
My guess is that your site is still running or perhaps your app pool is still running. Normally when you delete files that belong to a web site you will need to stop the web site and the app pool to make sure that none of the files are cached in memory. So if you shut down the app pool that your web app is using I think you should be able to delete the file.
Hope that helps.
Ben
|
|
|
|
|
Hi Ben,
I would like to explain my task more clearly...
Task: Upload Client photos to server and display it. (registration form)
Strategy followed:
1. Upload images to \upload\ folder in server.
2. Read all images in \upload\ folder and put it in sql database.
3. delete the image from \upload\ folder.
4. display it in the webform.
All this tasks should perform in a single button click "upload image"
I succeeded In SETPS: 1, 2 and 4.
I could not delete the file (step 3) soon after I upload the file into the database.
IN this situation i could not stop the site for deletion I need some suggestions that can delete the file soon after Step 2.
Plz let me know your thoughts.
Regards,
JJ
|
|
|
|
|
I am not sure what code you are using to read the images, but I would guess there is a chance that code is not properly closing its connection to the image it just read. The only other thing I have seen with images is the need to call garbage collection. So after you read the images and close the connections to the image then you may need to call gc.Collect
Hope that helps.
Ben
|
|
|
|
|
Here is an example of openread with a fileinfo
using (FileStream fs = fi.OpenRead())
{
byte[] b = new byte[1024];
UTF8Encoding temp = new UTF8Encoding(true);
while (fs.Read(b,0,b.Length) > 0)
{
Console.WriteLine(temp.GetString(b));
}
}
When the using is used the openread is closed when you reach the end of the using. So you are not closing your openread.
Ben
|
|
|
|
|
Thank you for the info. I will check once again all my connections and stream readers used to read the images to DB.
Regards,
Jagadeesh
|
|
|
|
|
dhulipudi wrote: foreach (FileInfo f in d.GetFiles("*.jpg"))
{
byte[] buffer = new byte[f.OpenRead().Length];
f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);
PhotoManager.AddPhoto(buffer);
f.Delete(); //ERROR HERE!!!
}
A quick brainstorming query: Did you observe whether this FileInfo keeps an handle also?
|
|
|
|
|
I want to know how should we give validation for phone numbers.
my phone number format is 0000-000-000
|
|
|
|
|
There are a couple of easy ways
1. Client-side
There is a nice ASP.net AJAX control in the toolkit which offers this if you want to use it. Link - http://ajax.asp.net/ajaxtoolkit/MaskedEdit/MaskedEdit.aspx[^]
2. Regular expression validator
You could write a simple regular expression to match the input against and use a validator on the page. The regular expression would be something like
^d{4}-\d{3}-\d{3}$ (Not 100% sure of the exact syntax)
Try www.regexlib.com as a great source for help and examples of regular expressions.
|
|
|
|
|
|
Heared of Regular expression ?
|
|
|
|