|
I tried like this but not working. Just I placed scriptmanager and updatepanel on the page and kept the fileupload control inside updatepanel... Have I followed correctly???
|
|
|
|
|
Wait a minute, were you referring to postback caused by clicking upload button or some other control?
If you mean after clicking on upload button, I guess it is not possible. Also, AFAIK, you cannot set the text of te textbox in the control so you cannot even keep the file path somewhere and just set it.
If you were referring to some other control which is causing postback, then keep just that control in the update panel and not the upload control.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Well... Html file control is very restrictive control. You cannot set value of file upload using javascript. You can only set using Browse Button.
Now when the page is posted back, the whole page is sent to the server, server processes it and rewrites the whole page to the response and which is written over the browser(client).
Thus if you select a file and some other button makes the postback, dont hesitate to save the file to the server as, the path, if not saved to the server, cant be shown in the file control at any case.
Otherwise you can show a popup (preferably using window.open) to upload files and do the upload immediately after user selects the file.
|
|
|
|
|
How to save and assign to the fileupload control? am trying to assign the path like this
FileUpload1.PostedFile.FileName = "Path"; but getting error "Property or indexer 'System.Web.UI.WebControls.FileUpload.FileName' cannot be assigned to -- it is read only.
any idea??
|
|
|
|
|
save path in any string/contol...
for label control...
label.text=File1.PostedFile.FileName;
|
|
|
|
|
but how to assign string value to fileupload control... I tried but got error messages... pls see my previous post...
|
|
|
|
|
You cannot as I told you. Fileupload should be the last thing to do in a page. Or else, have a listbox/listview (in case of multiple file upload) or a label with remove button or something in your page. That should work.
Something like what we get in Gmail or outlook.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
You cant do that ...
Even ASP.NET cant do this, thus it cant retain its value during postbacks..
Sorry.. You need to store it in server as soon as you find it in server. And then show the message, file uploaded successfully.. .or so...
|
|
|
|
|
still confusing.. How to store(session or any string variable) and assign to to fileupload control...
|
|
|
|
|
As I already told you, even if you set the value of a FileUpload control, it cant assign the appropriate file pointer to the browser.
So dont try to do this, rather when user choose the file, upload to the server immediately and work from the file placed in the server.
Cheers.
|
|
|
|
|
Hi,
How can we update all resource files contents in asp.net(2.0) pages?
is there any way in asp.net (2.0)?
Waiting for your reply
Known is a drop, unknown is an ocean
modified on Thursday, December 17, 2009 2:31 AM
|
|
|
|
|
Do you really expect a reply after the edit??
|
|
|
|
|
Hi EveryBody,
I got solution for this problem
this is the way
{
XmlDocument obj = new XmlDocument();
XmlNode rootNode;
obj.Load("E:\\Language\\App_LocalResources\\Default.aspx.resx");
rootNode = obj.SelectSingleNode("root");
foreach (XmlNode Node in rootNode)
{
string str = Label1.Text;
string txt = TextBox1.Text;
if ((Node.Name == "data") && Node.Attributes["name"].Value == "Label1Resource1.Text")
{
Node.SelectSingleNode("value").InnerText = txt;
}
}
obj.Save("E:\\Language\\App_LocalResources\\Default.aspx.resx");
}
Known is a drop, unknown is an ocean
|
|
|
|
|
Its Happy to share with all..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
I m making role based security with forms authentication in that, to make the role authentication work for forms authentication i modify web.config file like this:-
<configuration>
<system.web>
<authentication mode="Forms">
<forms name="MYWEBAPP.ASPXAUTH"
loginUrl="login.aspx"
protection="All"
path="/"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
<location path="administrators">
<system.web>
<authorization>
<!-- Order and case are important below -->
<allow roles="Administrator"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="users">
<system.web>
<authorization>
<!-- Order and case are important below -->
<allow roles="User"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<configSections>
.
.
.
.
.
.
.
</configuration>
and with this coding i m getting this error:
only one element allowed per config file and if present must be the first child of the root element.
plz help me with this error
|
|
|
|
|
I also faced this problem in the beginning..! this is due to presence of other config section..!
Check your config section there will be 2 config sections after debugging .!
keep one in comments or delete it..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi all
When i am declaring String type variable.
What shaould i use
String OR string
Is this effect on performance.
Thanks and regards,
Amit Patel
|
|
|
|
|
Even I'm not sure! When I once asked this to one of the MCTs that I know, he said its better to use "String" for declaring string type variables, but he wasn't able to give me any reasons either! But, I rarely use String/string type variables. I use StringBuilder for all string manipulations.
|
|
|
|
|
Dinesh Mani wrote: But, I rarely use String/string type variables. I use StringBuilder for all string manipulations.
StringBuilder is usefull when you are doing a large string ( inside loops ) operation. For Small operation its always preferable use string not stringBuilder.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I just use StringBuilder when I know that a specified string is going to be modified more than 2 times after the original assignment, otherwise I use general String/string. I guess its just general preference!
|
|
|
|
|
Dinesh Mani wrote: use "String" for declaring string type variables
Apart from having that sort of coding guidelines, I see no reason of doing that.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi
String is a .net data type
string is a C# data type
I think that there is no difference.
My Reason:
right click on the string and select "Go To Definition" from string's context menu
it refers to String definition
Mohammad Khansari
|
|
|
|
|
string is an Alias for System.String . IL version of both string and String is System.String. So there is no difference between them.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
No differece. Both are same.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
I m making role based security with forms authentication in that, to make the role authentication work for forms authentication i modify web.config file like this:-
<configuration>
<system.web>
<authentication mode="Forms">
<forms name="MYWEBAPP.ASPXAUTH"
="" loginurl="login.aspx" protection="All" path="/">
<authorization>
<allow users="*">
<location path="administrators">
<system.web>
<authorization>
<allow roles="Administrator">
<deny users="*">
<location path="users">
<system.web>
<authorization>
<allow roles="User">
<deny users="*">
<configsections>
.
.
.
.
.
.
..
<configuration>
and with this coding i m getting this error:
only one <configsections> element allowed per config file and if present must be the first child of the root <configuration> element.
plz help me with this error
|
|
|
|