|
How to register through command prompt
could to u tell me the process to register the aspnet_regiis-i
please dont mistake really i dont know....
step by step process.
hai all please clarify mny doubts
|
|
|
|
|
I have a dbf file which i need to access from asp.net page.
Can anyone explain to me which driver shall i use and how can i access?
Regards
hari
|
|
|
|
|
Use,
Dim ConectionObj As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DBFFILENAME;Extended Properties=dBASE IV;User ID=Admin; Password=")
|
|
|
|
|
Guys, I’m trying to debug a web page I created, based on users selection from the drop down lists, I’m changing the preferences on the page (such as background color, text, font etc). Now the problem I’m running into is that it only happens when I click the button twice. The first time button gets clicked, nothing happens but there is a post back to itself. When I try to debug it by setting break points, I see that when the control gets returned back to the browser and I click the submit button after selecting the properties from the drop down lists, it goes through the code for the event handler (btn_Click()) and then when it reaches the end, it comes back to the top of the event handler (btn_Click())
and goes through the code again. When it finish executing it again, VS.Net (2003 ) opens up an error message box saying there is no more source code to execute and that DO YOU want to see the disassembled code. I’m not quite understanding why is it happening? BTW I’m using cookies to store the values from the drop down so I can use them on subsequent pages. Also I’m using inline styles sheets and in aspx changing the properties of body and table elements for instance. But that still doesn’t explain why it needs the button clicked twice??? Can someone please explain? The code is shown below:
<br />
<br />
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
if (!IsPostBack)<br />
{<br />
HttpCookie cookie = Request.Cookies["preferences1"];<br />
ViewState["Referer"] = Request.Headers["Referer"];<br />
<br />
if ( cookie != null )<br />
{<br />
BackColor.SelectedItem.Value = (string)cookie.Values["BackColor"];<br />
ForeColor.SelectedItem.Value = (string)cookie.Values["ForeColor"];<br />
FontSize.SelectedItem.Value = (string)cookie.Values["FontSize"];<br />
FontName.SelectedItem.Value = (string)cookie.Values["FontName"];<br />
NavControl.SelectedItem.Value = (string)cookie.Values["NavControl"];<br />
}<br />
}<br />
globalNav2.Visible = false;<br />
}<br />
<br />
<br />
<br />
public void btnSubmit_Click(object sender, System.EventArgs e)<br />
{<br />
<br />
HttpCookie cookie = new HttpCookie("preferences1");<br />
<br />
<br />
cookie.Values.Add("ForeColor",ForeColor.SelectedItem.Value);<br />
cookie.Values.Add("BackColor",BackColor.SelectedItem.Value);<br />
cookie.Values.Add("FontSize",FontSize.SelectedItem.Value);<br />
cookie.Values.Add("FontName",FontName.SelectedItem.Value);<br />
cookie.Values.Add("NavControl",NavControl.SelectedItem.Value);<br />
<br />
Response.AppendCookie(cookie);<br />
<br />
}<br />
<br />
|
|
|
|
|
Tina P wrote: if ( cookie != null )
{
BackColor.SelectedItem.Value = (string)cookie.Values["BackColor"];
ForeColor.SelectedItem.Value = (string)cookie.Values["ForeColor"];
FontSize.SelectedItem.Value = (string)cookie.Values["FontSize"];
FontName.SelectedItem.Value = (string)cookie.Values["FontName"];
NavControl.SelectedItem.Value = (string)cookie.Values["NavControl"];
}
Write the above code in a separate function and call it in Button_Click Event.
The problem is because,
The Page_Load Event is called first than the Button_Click Event eventhough you clicked the button.
I am sure your problem will be solved.. Have a great day...
|
|
|
|
|
Hi Venkatesh, thanks for your response. I see your point from code reusability and conciseness point of view, but I can't understand how extracting that code, and calling a function instead that will execute the same code from the same location would solve this problem. I mean are you saying that code in Page_Load needs to execute at the time of button click (menaing when the code for the button click event handler is executed).
Venkatesh, could you please help me out here! BTW the code sample that I am following is on http://samples.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/apps/cookies1/cookies1.src[^]. They are using two pages, I wonder if that has to do with that second click?
Please help.
Thanks
~TINA
|
|
|
|
|
Ignore what he said, it makes no sense at all, even from a code reuse point of view.
only two letters away from being an asset
|
|
|
|
|
Hey have to you tried what I said before replying to my solution?
|
|
|
|
|
Have you tried what you said? Do everyone a favor and delete it.
only two letters away from being an asset
|
|
|
|
|
Of course the Page_load event is fired before the Button_Click event but moving the code you indicated into a seperate method will have no effect. Notice that it has been placed inside the if(!IsPostBack). Since the button click, or dropdown event is a postback the code will be not be executed and so is not the problem. Also notice that it appears to be setting the selected value of the dropdowns based on the value in the cookie. Calling it from the button click event would do nothing more than reset the dropdown lists.
only two letters away from being an asset
|
|
|
|
|
Are the dropdown lists set to autopostback?
Although it doesn't solve your problem directly, if you need to have values available on multiple pages then there are better ways to store them, such session or cache. Using cookies is fine if you want the data persisted on the client and available for other sessions.
only two letters away from being an asset
|
|
|
|
|
Hi Mark, thanks for the response. No they are not set to Autopostback = true, since there are more than one property settings that a user can select from the drop downs (if you get a chance, please look at the link I mentioned in the prior post....that's pretty much the same code (as far as the cookies) I'm using. Also they are using two pages to demonstrate that... and if you run the sample from http://samples.gotdotnet.com/quickstart/aspplus/doc/stateoverview.aspx[^] scroll all the way down to client side cookies...you would know what I'm talking about??? It just really weird? Any ideas???
Thanks
~TINA
|
|
|
|
|
Sorry without seeing your complete code sample I don't see any reason off hand why you would be getting two events for the button click. If you are following the sample you pointed to it should work fine.
only two letters away from being an asset
|
|
|
|
|
It's okay Mark, thanks though
BTW you mentioned about looking at the entire source code, well the sample that I had posted earlier is pretty much the code that has a bug. Even if you run from the sample link (which I'm assuming you have) notice that the color and others don't change right away. It requires clicking SUBMIT button twice. And the source code for that is at the same link (right next to where it says RUN SAMPLE). I've spent a lot of time, but can't seem to figure out why...but my guess is that there's got to be something really stupid that we can't seem to spot! I'd appreciate any help
Thanks
~TINA
|
|
|
|
|
I ran the sample, after clicking once on the submit button it was returned to the original page with the colors updates as selected. Only on click was required.
only two letters away from being an asset
|
|
|
|
|
Are you serious, that's amazing coz I've been trying the same thing for a while...and even the one on that gotdotnet site requires two!!!! Anyways I'd really appreciate if you could show it to me either here or e-mail it to me at journeys49@yahoo.com. Thanks for your help...I really appreciate it!
Thanks
~TINA
|
|
|
|
|
There isn't anything to show. Clicking run sample brings up a page with the Customize This Page link (and other text). Click the link it goes to the Customize This Page page. Select values from the dropdowns, click submit and it goes back to the original page with the colors set as selected.
I'm using IE7. Is it a browser issue on your end?
only two letters away from being an asset
|
|
|
|
|
Hi Mark, sorry I thought you meant you created a sample web project in VS.Net and tried the sample code in their with only one page like me ( i.e. without going out to another page cookies.aspx from curomize.aspx). Yeah I don’t think it’s a browser issue. I think its in the code… I’m also using IE 7.0. Anyways thanks for the help anyways. I just can’t seem to figure out why is it happening?
Thanks
~TINA
|
|
|
|
|
Hi Mark, isn’t that true that Page_Init event is where all the controls on the page gets initialized before the page actually loads. Well if that’s the case than my problems should have been fixed.
I added this handler into my code behind and explicitly wired it too (this.Init += new System.EventHandler(this.Page_Init))
<br />
private void Page_Init(object sender, System.EventArgs e)<br />
{<br />
HttpCookie cookie = new HttpCookie("preferences1");<br />
<br />
if(IsPostBack)<br />
{<br />
cookie.Values.Add("ForeColor",ForeColor.SelectedItem.Value);<br />
cookie.Values.Add("BackColor",BackColor.SelectedItem.Value);<br />
cookie.Values.Add("FontSize",FontSize.SelectedItem.Value);<br />
cookie.Values.Add("FontName",FontName.SelectedItem.Value);<br />
cookie.Values.Add("NavControl",NavControl.SelectedItem.Value);<br />
<br />
Response.AppendCookie(cookie);<br />
}<br />
}<br />
But now as you would imagine….its going through the init event at the very first time page is accessed…but at that point of course it doesn’t have the right value from the drop down. Then it goes through page load and then Page_click (same code) and then I get the right values there (in debug mode). The page only gets updated when the button gets clicked and in the debug more it doesn’t even get to the point where I can click the button once again. It says finish executing code, wanna see disassembly? Can you please help??
|
|
|
|
|
hi there.
i am trying to develop an application using a 3rd party graphing tool and one of the functions in that is to attach a bitmap to a node as a view. i want to create a bmp on the fly in .net, which i have already done, but the function says it needs a picture from iDispatch. i did read somewhere that there is function in system.windows.forms.axhost named GetIPictureDispFromPicture that one can pass in system image and get an interface pointer. my question how to implement this in ASP.NET. how is the axhost class made available to a .net page?
thank in advance!
Ashwin
|
|
|
|
|
I have a Save button on a web page.
I want to disable the button when clicked, so that the user does not click it more than once, as the serevr side code is being processed.
i disabled the button by calling a javascript function -
btnSave.Attributes.Add("onClick","return buttonDisabled();") ;
In the Javascript file i have -
function disableButton()
{
var btnSave = document.getElementById('btnSave') ;
btnSave.disabled = true ;
return true ;
}
since the button gets disabled my server side code(in C#) does not get executed.
thanks a lot for any kind of help
|
|
|
|
|
You need to call Page.GetPostBackEventReference(), and then put a call to __doPostBack() in your JavaScript function.
Here's how I did it in my test application:
private void Page_Load (Object sender, System.EventArgs e)
{
String clientScriptFunc = String.Format ("DisableButton_{0}", btnSubmit.ClientID);
if (!IsClientScriptBlockRegistered (clientScriptFunc))
{
RegisterClientScriptBlock (
clientScriptFunc,
GenerateDisableButtonScript (btnSubmit, clientScriptFunc)
);
}
btnSubmit.Attributes.Add ("onclick", String.Format ("return {0}();", clientScriptFunc));
}
private String GenerateDisableButtonScript (Button btn, String clientScriptFunc)
{
StringBuilder script = new StringBuilder ();
script.Append ("<script language=\"javascript\">\n");
script.AppendFormat ("function {0}() {{\n", clientScriptFunc);
script.AppendFormat (" var myButton = document.getElementById('{0}');\n", btn.ClientID);
script.Append (" myButton.disabled = true;\n");
script.AppendFormat (" {0};\n", Page.GetPostBackEventReference (btn));
script.Append (" return true;\n");
script.Append ("}\n");
script.Append ("</script>\n");
return script.ToString ();
}
GenerateDisableButtonScript() will output a JavaScript function like the following:
<script language="javascript">
function DisableButton_btnSubmit() {
var myButton = document.getElementById('btnSubmit');
myButton.disabled = true;
__doPostBack('btnSubmit','');
return true;
}
</script>
<div class='ForumSig'></div>
|
|
|
|
|
Hello,
I am attempting to create a page which will display data pulled from a database. What I would like to do, but not sure how to do it, is to have users input a Subject then the body of their post but when I pull up the page all relevant topics display the different posts in a Tree View. For example say a users starts a thread with topic "Pissed at you" I would like all responses or added blogs under this topic be displayed as a treeview. Pretty much the same as we see here on this page. I would also like to have all the topic collapsed with a plus sign then when clicked on with will expand to display the content of their blog. Any assistance will be greatly appreciated.
Greg
Coding makes the world go round!!!
|
|
|
|
|
What's the best way to use ASP.NET 2.0 and AJAX? I know there is ASP.NET AJAX but I have uninstalled it after trying it, I like hand coding mine better. My current environment is ASP.NET 2.0 with code in separate files all code is VB.NET, I'm using a master page to build a frame and I have a group of web controls created. I have my AJAX calling an aspx file, what I'm doing so far is working, but Visual Studio seems unhappy that my AJAX aspx file have no html, head, body or forms tags. Also, I'd like to make most of my controls AJAX enabled (and VS doesn't expect to see the html, head, etc. tags) but I can't directly access them (because they're .ascx files).
So the answers I'm looking for are, should I just continue on using .aspx files (and ignore errors), is there a better/more correct way to generate content to feed to JavaScript, is there a file extension that I can use as a web control or for AJAX as needed?
Thanks for any information you can provide.
|
|
|
|
|
RX Maverick wrote: I know there is ASP.NET AJAX
You mean ATLAS ? Yeah, that exists, and it's pretty simple to use, but expensive as well.
RX Maverick wrote: I have my AJAX calling an aspx file, what I'm doing so far is working, but Visual Studio seems unhappy that my AJAX aspx file have no html, head, body or forms tags
Just turn that validation off. Or, if it worries you, define a file extension like aspxa, set it up in IIS, and it will all be fine.
RX Maverick wrote: Also, I'd like to make most of my controls AJAX enabled (and VS doesn't expect to see the html, head, etc. tags) but I can't directly access them (because they're .ascx files).
What's the problem here ? I don't understand ?
RX Maverick wrote: should I just continue on using .aspx files (and ignore errors),
For the AJAX postback ? Yes, almost certainly.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|