|
what is the subject name? i could not find, unless i have some keyword.?!
Muthu
|
|
|
|
|
No, i meant:
Go to "New message" as if you were gonna post a new message and see how it works
You are gonna have to look for that js function,, maybe it is embeded in the html or maybe it is in an external .js file
Alexei Rodriguez
|
|
|
|
|
I am running into an issue with the fileupload control.
Standard code... just a test After clicking on button1 I do get the Yay response. Clicking button1 again right after, I get the Nay response. However, if I choose a file and then click on button1 and it has a file, I get the Yay response and the text in the upload control clears. I refresh the page, and I get the Yay response. Is there a way to control this?
protected void Button1_Click(object sender, EventArgs e)
{
if (this.FileUpload1.HasFile)
{
Response.Write("Yay!");
}
else
Response.Write("Nay!");
}
|
|
|
|
|
That is how the file up load works. The file upload control will post the file only once.
Think about it. If you have a file selected by the user, would you want that file to be sent to the server on every additional postback?
protected void Button1_Click(object sender, EventArgs e)
{
if (this.FileUpload1.HasFile)
{
Response.Write("Yay!");
//Implement method to save file
}
else
Response.Write("Nay!");
}
I didn't get any requirements for the signature
|
|
|
|
|
I understand that's how it should work. And no, I don't want the file to be sent on every postback. Just if you click an upload button with a file in the upload control, and a user clicks refresh on their browser, the same action is performed and the upload control still is showing HasFile = true. I'm trying to not let the code to add a file run again if a browser refresh is performed after clicking upload.
modified on Friday, September 26, 2008 3:32 PM
|
|
|
|
|
Anyone?
Revolutionary: Disk drives go round and round.
|
|
|
|
|
I am looking into loading the content of a usercontrol from a database instead of from a ascx file. I have found some information on ControlParser but I have been unsucessful in getting it to work.
Does anyone have any examples of loading a control in this manner?
Thanks
|
|
|
|
|
Wow. That sounds like a great plan
Are you seriously trying to store code in a database? Why would you do that?
I didn't get any requirements for the signature
|
|
|
|
|
This is only for page template layouts so that I can allow the user to choose from a layout or copy it and edit it themselves.
|
|
|
|
|
|
Interesting.
Seems more complicated than something I would tackle.
I would use css for my styling and allow the user to set some css properties. But that's about as far as I would go.
I didn't get any requirements for the signature
|
|
|
|
|
Hi,
I'm working with Asp.Net 2.0. I want to use Tab or View and MultiView. Initially, View1 should be displayed. If I Click View2, View1 should be gone inside and View2 should be come out. (Like Hide and Show in Menu) How to use this facility in my appn. Please help or I need help for Tab. Thanks in Adv.
Balasubramanian K.
|
|
|
|
|
You don't click on a multiview. It's basically a way to show multiple "views" on one page. You place a multiview on a page, and add views to it. You then program the event that you want to switch views.
If you have tabs, use the click event, and set the active view of the multiview.
|
|
|
|
|
how to display the analytical report from SQL 2005 using dashboard format
|
|
|
|
|
With code?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Can't you just set the current display mode?
System.Web.IDontWantToProgramItMyself.SomeoneElseShouldDoItForMe.Format = System.Web.IDontWantToProgramItMyself.SomeoneElseShouldDoItForMe.Formats.Dashboard
|
|
|
|
|
LOL
Good answer.
I didn't get any requirements for the signature
|
|
|
|
|
Damn, never thought of that
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hello guys,
I've got a few controls such as Buttons on a page. When the button gets clicked, I'm suppose to for instance take the cursor and put it into a text box down below. This would be easy to do by just calling .Focus on the text box under the button's event click handler if the text box was also located on the page itself. But the problem is that the text box is actually embedded inside a user control (.ascx file). Can someone tell me how to accomplish such a thing?
Thanks
Tina
|
|
|
|
|
You need to add the onClick event on the server side. Get the clientID of the control inside the usercontrol using UserControlName.FindControl("TextBoxName").ClientID and then use that for the javascript statement for the onClick handler.
|
|
|
|
|
Note: The following is using javascript. You didn't specify if you were using client side events or server side events. The code behind code is VB.NET
The easiest way to do it is to add the "onclick" attribute to the button during Page_Load in the code behind.
Button1.Attributes.Add("onclick", "MoveFocus('" & userControl1.Controls("textbox1").clientID & "');")
What is happening here is that you will be sending the name of the textbox in the user control to the javascript function "MoveFocus". "MoveFocus" will be performed on the client-side when the button is clicked. "MoveFocus" should look something like this:
function MoveFocus(TextName)
{
var txt = document.getElementById(TextName);
txt.focus();
}
Hope that helps point you in the right direction.
Obligatory Disclaimer: Any code that appears may be untested. It is merely meant as a guide. If it doesn't work, don't blame me. Some parts of the job require independence. Or Google.
Obligatory Disclaimer: Any code that appears may be untested. It is merely meant as a guide. If it doesn't work, don't blame me. Some parts of the job require independence. Or Google.
Have faith in yourself; amateurs built the Ark, professionals built the Titanic.
|
|
|
|
|
Hello guys and thanks for your response. It seems like both of you guys are talking along the same lines but I still cant get this to work.
T7bros, as you mentioned above, I added the code Button1.Attributes.Add("onclick", "MoveFocus('" & userControl1.Controls("textbox1").clientID & "');") in the page's load event handler.
Here's what I've added:
addButton.Attributes.Add("onclick", "MoveFocus('" + pumpassembly.FindControl("_installationDateTextBox").ClientID + "');");
I'm adding the Javascript function as you menioned in the aspx page under script block:
:
function MoveFocus(TextName)
{
var txt = document.getElementById(TextName);
txt.Focus();
}
When I set a break point, it looks like its blowing up at ("_installationDateTextBox").ClientID meaning either its not finding this text box control on the user control or there's an issue with the client ID. Also _installationDateTextBox is the ID of that text box that needs to have the focus when the button gets clicked, they why are we doing .ClientID? Any ideas whats going on here?
Thanks
Tina
|
|
|
|
|
Tina P wrote: it looks like its blowing up at ("_installationDateTextBox").ClientID
Make sure that _installationDateTextBox exists, it should work, if you are getting an exception, it must be because no control has been found and nothing is being returned which doesnt have a clientid property
A most secure way to access controls inside a user control is to expose controls as properties
Just create a public readonly property that returns the textbox you want
Then, youll be able to reference that textbox like: pumpassembly.myTextbox.focus;
If you still get the same error (null reference), it could also be that the textbox hasnt been created yet and you might need to read a little about EnsureChildControls
Alexei Rodriguez
|
|
|
|
|
Hello there, Yes you are correct...it's throwing a NullReferenceException (pointing towards the clientID property). And to answer your question, yes "installationDateTextBox" (which is just the ID of the text box located in the ascx file) is found because when I try to see what's present in the myUserControl inside the debugger, I see all the controls that are embedded in myUserControl including the installationDateTextBox. But apparenetly it's not grabbing the clientID and therefore has Null in the paremeter list for MoveFocus function.
_
addButton.Attributes.Add("onclick", "MoveFocus('" + myUserControl.FindControl("_installationDateTextBox").ClientID + "')");
What am I doing wrong here you guys???
Thanks
Tina
|
|
|
|
|
Tina P wrote: And to answer your question, yes "installationDateTextBox" (which is just the ID of the text box located in the ascx file)
Whats the name of the control, installationDateTextBox or _installationDateTextBox??
Post the sourcecode of your ascx file
Tina P wrote: myUserControl.FindControl("_installationDateTextBox")
This must return a control, and all controls have a clientid property, the exception must be because the control is not found and not because of the clientid property
Alexei Rodriguez
|
|
|
|