|
Hi All,
We are looking to refactor some backend code with an asp.net app. In our Bus/data objects we are returning datareaders. We heard that this is a bad practice to use. We are planning on using the MS Ent Lib 2.0 . Which is the preferred method to return data to pages using Ent Lib?
Thanks,
Jamming J
|
|
|
|
|
Depends! Usually a DataSet/Table with the info from the database.
|
|
|
|
|
Hi
Whatever i add to a textbox.Text persists during a postback but other stuff i fetch from the Database that isn't shown to the user, how am i supposed to persist it without using Session[] variables.
i tried using global variables in the aspx page but they are cleared it seems.
I have a lot of session variables already and its getting confusing!
thanks for your help.
|
|
|
|
|
Hi,
You should use session only when you have to persit data between more than one page.
Otherwise if it is related to only one page, you can fetch data from database and store it into a html hidden control, ie, <inpupt type="hidden" runat="server">. Data stored in server side html hidden cotrols are persisted during a postback.
|
|
|
|
|
Arabinda Kolkata wrote: Hi,
You should use session only when you have to persit data between more than one page.
Otherwise if it is related to only one page, you can fetch data from database and store it into a html hidden control, ie, . Data stored in server side html hidden cotrols are persisted during a postback.
-Prakash
|
|
|
|
|
Hi,
I don't know how it happened. I posted the answer but it was posted by someone else name. The data is also not proper. So I'm posting it again.
You should use session only when you have to persit data between more than one page.
Otherwise if it is related to only one page, you can fetch data from database and store it into a html hidden control, ie, .
<input type="hidden" runat="server" />
Data stored in server side html hidden cotrols are persisted during a postback.
Thanks,
Pradipta Basu
|
|
|
|
|
You can also true viewstate on as well. Or use viewstate
Before Post
<br />
ViewState["UserName"] = UserName<br />
After Post
<br />
UserName = ViewState["UserName"]<br />
Remember this will not persit between pages.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
I prefer to use viewstate in these type of cases where we need to store data in encrypted format, so that no one can recognize the real data. If that is not needed hidden fields are a better choice, since viewstate can end up to be very large.
Pradipta Basu
|
|
|
|
|
Pradipta Basu wrote: Hi,
I don't know how it happened. I posted the answer but it was posted by someone else name. The data is also not proper. So I'm posting it again.
You should use session only when you have to persit data between more than one page.
Otherwise if it is related to only one page, you can fetch data from database and store it into a html hidden control, ie, .
Data stored in server side html hidden cotrols are persisted during a postback.
Thanks,
Pradipta Basu
-Prakash
|
|
|
|
|
I'm having problems finding the best way to set the mouse over attribute for several buttons.
right now I do something like :
btnClear.Attributes.Add('onMouseOut', 'setStyleOff(this.id));
and I do this in the page load for each button, a mouse over and a mouse out event
However this can get quite tedious when you want all your buttons to have the same effect and some of them are embedded in datalists or grids.
Is it possible to set the mouse over/out event in a skin file or a CSS style sheet so that it will run the same java function for EVERY button on a page?
If so, could someone give an example of how to do this?
Kris
|
|
|
|
|
IMO, you'll have at least two options here:
+ Use the skin file to define the client side mouse events for the server button control.
+ It's a good candidate to develop a custom button control which by defalt has the mouse event handlers defined.
|
|
|
|
|
Could you give me an example on the syntax to add a mouse over event to a button in a skin file?
The only way I know how to do this is code file for a given page.
|
|
|
|
|
In a skin file, you simply declare the button:
<asp:button on_mouseover="yourclientsidefunction();" ..../> then in the Page directive, you can simply set the theme for the web page. The settings of the button in the skin file of the specified theme will be applied to all the buttons on the web page.
|
|
|
|
|
Hi Guys,
We have been having a discussion around our shop about how we are going to persist data from one page to the next. As usuall we have different opinions. Ok first things first. We are using 2.0 framework and VS 2005. We have a header for each page that is 98% static, won't change unless someone enters a new order #. We are going to use MS Ent Lib 2.0 with a wrapper around it just so we can remain consistant with its usage. So now getting to the meat of the question. Some of us thought we would persist the data in a base page using session, using Enterprise "cache" or httpContext. What do u guys think of using these different options and how would you persist the data between pages?
Thanks,
Jamming J
|
|
|
|
|
i want to show the data from my database which is set by sql 2000 on the drop down list. However, i dont know how to start though the connection is fine. thanks for concerning my question
|
|
|
|
|
hi,
Inside If Not IsPostBack() Then.... End If you have to create the dataset and bind it to that drop down list. Consider the following code:
Dim dsTest As New DataSet<br />
Dim daTest As New SqlDataAdapter("select tid from test", con)<br />
daTest.Fill(dsTest)<br />
<br />
ddl.DataSource = dsTest<br />
ddl.DataTextField = "test"<br />
ddl.DataBind()
|
|
|
|
|
|
Hello.
Does anyone tried to use cross domain cookies?
I have two asp.net applications running on diferent servers on the Internet. When my users visit the first application I create a cookie with some values.
When the user visits (or gets redirected) to the second application I need to retrive the values to be used on the second application.
Does anyone tried to use this or know if this is possible?
Thanks in advance
|
|
|
|
|
How to Import the contacts from Outlook.
I found solution on it, but it has some problems.
I've done following steps
- I've imported the ACTIVEX component which access Outlook contacts and delivers it in text file.
-Access that file and put contacts in database
PROBLEM - When the text file is delivered then Clent accesses SERVER's fiel instead of it's own file.
|
|
|
|
|
How to access C:\ or D:\ with Java script.
|
|
|
|
|
The short answer: under normal circumstances, you can't.
The browser runs as a sandbox with no rights to the user's local machine. The basic idea is to ensure that no web code can perform actions that could damage the user's machine. Allowing access directly to the client's drives would be a major security exploit. Unless you are developing for a controlled environment, such as your corporate intranet, you really don't want to go down this road.
That being said, there are two ways that come to mind to accomplish it. If you are concerned with IE only, you could write an ActiveX control that has functions to interact with the drives, and manipulate it using javascript. As a cross-browser alternative, you could also create a signed javascript file, and assert that you need local file system permissions.
Hope that helps a bit.
--Jesse
|
|
|
|
|
How can I run the routine in ActiveX control through Javascript.
|
|
|
|
|
You will link the ActiveX control into the page using the HTML object[^] tag. At that point, it becomes just another object on the page. You can retrive it using normal javascript DOM techniques, such as getElementById()[^]. Once you have a reference to the ActiveX control, you can access any public members of it.
Hope that helps.
--Jesse
|
|
|
|
|
How to navigate through dropdownlist with arrow keys .
Whenever we change the index of dropdown then the SelectedIndexChanged Event Occurs, but we dont want to fire this event on Up and Down arrow keys then what to do?
Also I have another question that - when the focus is on the dropdown and we press CTRL+F4 then dropdown of AddressBar opens Instead of that dropdown.
|
|
|
|
|
To navigate the dropdownlist, you'll need to write some javascript to handle the onkeypress event. In that code, you'll want to test for the arrrow keys, and adjust the dropdown list's selectedIndex property. Google has plenty of examples. To get you started, check out:- An example[^] of handling key presses
- An example[^] of working with the dropdown list's options and selected index
As far as the behavior of CTRL+F4, opening the IE address bar is an operating system level decision. I believe that you can capture the keypress, perform your desired action, and not bubble the event using the same technique as above. I haven't tested it, so you may want to give it a try.
Hope that helps.
--Jesse
|
|
|
|