|
|
I am trying to get a value in response to user button selection, eg Butoon 1, button 2, button 3 selected, want sequenceObj ="1,2,3,", this part is ok but not getting anything in code behind.
This is what I have and I know it's probably not right but I have not done things like this before.
I am hoping some one can tell me how to go about it.
in .cs file //there is probably a lot more to do in relation to this but don't know how and is probably why I am not getting values.
bnSubmit.OnClientClick = Page.ClientScript.GetPostBackEventReference(this, "sequenceObj.value");
in .js file
function buttonClick(s)
{
sequenceObj.value += s + ",";
}
function getSequence() //does not get here!
{
return sequenceObj.value;
}
in .aspx file
<script type="text/javascript"> sequenceObj = new Object(); sequenceObj.value = ""</script>
<asp:Button ID="bnSubmit" runat="server" Text="Submit" Width="100%" onclick="bnSubmit_Click" Height="38px" onclientclick="return getSequence()" UseSubmitBehavior="False"/>;
Any help would be greatly appreciated.
theLizard
|
|
|
|
|
I have two asp.net websites that relate to eachother:
1) My normal site.
2) The blog portion of my site (based off of the opensource BlogEngine.NET project)
I want to have my blog site setup as a subdomain of my regular site (i.e. blog.mySite.com). My question though is what's the best way to setup these sites? Should I keep them as two separate websites and simply have my blog site be referenced via the blog.mySite.com? Or should I merge the two into one giant asp.net solution?
The potential downside I see to keeping them separate is I want my user to maintain their user credentials when they hop over to the blog site & vice versa. I'm not sure if this will create any issues.
The potential downside to merging them is the user will have to load BOTH sites when they first visit www.mySite.com, regardless if they plan on clicking on the blog or not.
So just curious how you guys would set this up...would you merge them into one .net solution or keep them separate?
Thanks.
|
|
|
|
|
I have to create buttons,forms at runtime after reading XML file.
XML file will contain numbers of buttons and froms which i have to create run time.
Please let me know right way.
|
|
|
|
|
Where do you want to place these buttons? On the dynamic forms?
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...!!
|
|
|
|
|
Windows Forms and Buttons both will be created at runtime.
|
|
|
|
|
You are in the wrong forum then.
You can create a user control which exposes a property where you can set the button count. That user control will in turn have a TableLayoutPanel or a FlowLayoutPanel which will ensure the layout comes out good. Now, when you set the button count, you can add cells to the TableLayoutPanel and add buttons to it. You can also have a delegate exposed from the user control which will act as a common click event for the button and which can be handled anywhere.
Then, create a form and add this user control to it.
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 really appreciate if you could provide me sample code or any useful link.
|
|
|
|
|
I don't have a sample code for this for now. You can try this:
1. Create a user control with a tablelayoutpanel in it.
2. Add a method to it that takes in one integer parameter. In that method, add rows and columns to the panel and add buttons in it.
3. Search for "delegates and events" or "c# expose events from user control" to understand how to expose the click event for the buttons and handle it in the creating form.
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...!!
|
|
|
|
|
Do like this :
Button newButton = new Button();
newButton.Location = new Point(30,50);
newButton.Text = "Click Me";
newButton.Size=new Size(50,25);
newButton.Click += new EventHandler(newButton_Click);
this.Controls.Add(newButton);
Place your Eventhandler as newButton_Click .
public void newButton_Click(object sender, EventArgs e)
{
}
Please do post in right forum next time...
|
|
|
|
|
I want to upload Image on server using webclient. i write this code its working on local server. but not working on myweb server. please give me a correct answer.
Dim imgpath As String = "C:\Documents and Settings\All Users\Documents\My Pictures\Sunset.jpg"
Dim ipath As String = Server.MapPath("Images")
Dim a() As String = Split(imgpath, "\")
UploadPath1.Text = ipath & "/" & a(a.Length - 1)
webClient.UploadFile(ipath & "/" & a(a.Length - 1), "Post", imgpath)
its give error
Server Error in '/' Application.
--------------------------------------------------------------------------------
Could not find a part of the path 'C:\Documents and Settings\All Users\Documents\My Pictures\Sunset.jpg'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Documents and Settings\All Users\Documents\My Pictures\Sunset.jpg'.
Source Error:
Line 17: Dim client As New Net.WebClient
Line 18: client.Credentials = Net.CredentialCache.DefaultNetworkCredentials
Line 19: client.UploadFile(ipath & "/" & a(a.Length - 1), "Post", imgpath)
Line 20: client.Dispose()
Line 21: End Sub
Source File: D:\Webserver\aksinfotech.in\www\UploadImage\Default.aspx.vb Line: 19
Stack Trace:
[DirectoryNotFoundException: Could not find a part of the path 'C:\Documents and Settings\All Users\Documents\My Pictures\Sunset.jpg'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +193
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1162
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) +67
System.Net.WebClient.OpenFileInternal(Boolean needsHeaderAndBoundary, String fileName, FileStream& fs, Byte[]& buffer, Byte[]& formHeaderBytes, Byte[]& boundaryBytes) +203
System.Net.WebClient.UploadFile(Uri address, String method, String fileName) +253
[WebException: An exception occurred during a WebClient request.]
System.Net.WebClient.UploadFile(Uri address, String method, String fileName) +538
System.Net.WebClient.UploadFile(String address, String method, String fileName) +27
_Default.Upload_Click(Object sender, EventArgs e) in D:\Webserver\aksinfotech.in\www\UploadImage\Default.aspx.vb:19
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
|
|
|
|
|
mohdjaved1 wrote: Could not find a part of the path 'C:\Documents and Settings\All Users\Documents\My Pictures\Sunset.jpg'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Your error says that the file does not exist on the server.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Respected,
I have a string like JC00123 and I am split this string from from 2th position
but it not give proper o/p. It split like this 123 only except the zeros Please help me.
Thanks
|
|
|
|
|
Please post the code you have written for splitting the string.
|
|
|
|
|
The code is :
grno = "JC00234"
Dim splitgrno As Int32 = CType(grno.Substring(2), Int32)
|
|
|
|
|
0) You're using Visual Basic.
1) You're not "splitting" the string, you're extracting part of it.
2) You're converting "000234" to an integer. The integer will be equal to 234. If you want to maintain the leading zeros, you have to leave it as (or convert it back to) a string.
3) I've noticed this leading-zeros on an integer question pop up several times this week. Will you guys please tell your instructors to give you the low-down on this particular topic BEFORE giving you your homework assignment.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Dear ALl,
What is the most appropriate way to impersonnate a user when other application are expected to e our web service.
In other word i need to provie a username and password for users who use my web service.
regards,
dghdfghdfghdfghdgh
|
|
|
|
|
There are various ways to do it.If your users are in the domain then you can deploy your web service with windows authentication.Another way when some one access to your web service method ask credential as a parameter then authenticate the request and return the result as appropriate.Also
Have a look
Cheers!!
Brij
|
|
|
|
|
Dears,
What i want is to ask for username and password when any application try to add my web service as a web reference.
regards,
dghdfghdfghdfghdgh
|
|
|
|
|
I want to compress webresource.axd file in 2008 server iis 7.
Right now I am able to compress webresource.axd file using the MbCompression.dll in 2000 server iis 6 it is working but iis 7 it is not working.
|
|
|
|
|
i hav three dropdown list country,state and city with out update panel my password will erased and if i use update panel my state ddl is not filter by country i already googled but i my organization all other sites are blocked only asp.net and cp is runnin.........
plz help..........
|
|
|
|
|
bhavnvyas wrote: i hav three dropdown list country,state and city with out update panel my password will erased and if i use update panel my state ddl is not filter by country
I didn't get your question. can you please rephrase the question ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
thnx for rep........
in my application i have user detail fields like user name password city state and country in this i hav to maintain password text even after page load. my page loades when i select Country India from India state dropdown list will bind and same for city so now INDIA>MAHARASTRA>PUNE but due to this my password field will be erased.
|
|
|
|
|
Try this:
Take 2 update panels.
Put all user details related controls in one update panel and password related controls in second one.
In this way, when you select an item from drop down list only the first update panel will refresh.
|
|
|
|
|