|
Here is my scenario... a user control (UCCulture) with a dropdown box for culture. Autopostback on change of dropdown box sets the thread culture to new value early in page lifecyle.
In most cases, a post back does not require rebinding data, however, in the case of a culture change, this often does require a rebinding of data using the newly selected culture.
I'm looking for the best way to allow UCCulture to fire a CultureChanged event and have the page, masterpage and all other user controls subscribe to this event, so they can rebind their data, if necessary, when the event is fired.
I have base classes for Page and UserControl, and would prefer to wire up the events in these base classes instead of manually writing the event hookup code individually.
Anyone developed a pattern for this type of thing already?
|
|
|
|
|
Hi,
I'm hoping you guys can help me with a question.
I've been reviewing someone else's code, and I found that in some places where they are using a repeater to display data from a database, in places where the Database query will only ever return 1 row of data. They are returning a reader, loading a datatable with the reader data, and binding that datatable to a repeater.
now am I nutz, or is that extremely inefficient?
it's always been my practice to take the reader, check for rows, and then set individual controls (like literals) to the fields directly.
the only reason I can think of to do this, is that if for some reason there isn't any data, the repeater won't display anything. however I've always handled this by wrapping the results in a div, and setting the div's visibility property to false if there is no data returned.
please let me know your opinion.
thank you
|
|
|
|
|
There are better ways of the doing that, but it probably doesn't matter.
As you say you can always count the rows in the data table. If no rows exists display another div.
If this application is going to have 10K+ users then you might want to look at doing this in a more efficient way. But really it is probably fine. However, you really should not use a repeater if you are only going to have one record. That's just common sense, it is called a repeater for a reason.
Also, why use a datareader to get a datatable. This is foolish. Use the dataAdapter to get a dataTable. Use DataReader to iterate through read only data or bind a control directly to a datareader object.
I didn't get any requirements for the signature
|
|
|
|
|
Thanks Todd
you mentioned a better way?
do you mean a better way than binding the reader data to literals?
if so, would you mind giving more details?
This particular page get's 4-5k views daily, and will see more as the application gets expanded, and marketed more, so I will be re-writing this page at least.
I have no idea why they are retrieving the data like that, my guess is the person who wrote it didn't know any other way of binding data than by using a datatable.
I have a feeling I'm going to find lots more WTF's when I get the final codeset and can look at everything together.
|
|
|
|
|
icewolf_snowfire wrote: do you mean a better way than binding the reader data to literals?
if so, would you mind giving more details?
Yes I did. It depends on your individual situation, but if you are only viewing one record I wouldn't use any databinding. Just put the controls you need inside a div tag. Write an init method to load the data (obviously only during the initial load and not postbacks).
If the data is constantly changing then use a dataReader or output parameters in a stored procedure. If the data is rather static then cache the data. I wrote a sample article about how to do that here[^]
Also, check this out http://msdn.microsoft.com/en-us/library/ms998549.aspx[^]
I didn't get any requirements for the signature
|
|
|
|
|
How to share a session between 2 soap clients?
The soap clients are generated by VS2008 in a VB.Net Windows Froms project by making a reference. The 2 clients make requests to the same "Project" but different "WebService" classes. I don't find a way to add a cookie container or sortlike to share the session.
Dim service1 As New ServiceReference1.Service1SoapClient(bhp, New ServiceModel.EndpointAddress("http://localhost/TheWebService/Service1.asmx"))
Dim service2 As New ServiceReference2.Service2SoapClient(bhp, New ServiceModel.EndpointAddress("http://localhost/TheWebService/Service2.asmx"))
It feels good to learn and achieve
|
|
|
|
|
Is there anything useful for your in this CP article? Sharing Session Across Applications[^]
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hy, thanks but i'm afraid it's not...
I guess the problem resides on the client side(SOAP Client) and not on the server.
I use a BasicHttpBinding class and need to set the property "AllowCookies" to true for the client to remember the session id.
Now when i want to share that session/cookie between 2 SOAP Clients, they call a different "WebService Class" in the same "WebService Project" (ASP.NET VS2008).
I still did not figure out how to do this, so i made a "work around"... Not so clean but now the PHB is happy...
I posted this problem earlier (VS2008 SOAP Client - losing Session problem[^]).
It feels good to learn and achieve
|
|
|
|
|
To be a little more specific, it is not a HttpApplication but a Windows Forms Application calling the web service. Maybe i better posted it in another message board. But because i am not sure the problem resides on the Client side, and it's includes ASP.NET, i posted it here.
It feels good to learn and achieve
|
|
|
|
|
Hi All,
I am trying to bind a GridView with an user defined object it is binding fine when I dont use AlloPaging="false" but is giving exception when I try to implement paging in it.
It is giving Datasource doesnt allow serverside paging.
Can anybody please advice me how can I achieve paging in GRidView when I bind it with an object.
Any code snippet or any links are verymuch usefull.
Thanks,
Md. Abdul Aleem.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
Check this
Paging without a wizard (SqldataSource control) [^]
Hope it Helps
Vuyiswa Maseko
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
|
Let us See your Code and we will tell when you have gone wrong. Another thing you say you have set
AlloPaging="false"
that is not Correct its
AllowPaging="false"
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
Ok spelling mistake but it is not the problem in the real code
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
Do you still have a Problem ? if so please Post your Code. i see your work for NIIT, which Country ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
hi all
I am trying to create a web farm in iis6. I have set session mode=stateserver.
But the session expires frequently .please guide on this
Tejesh
|
|
|
|
|
tejesh123 wrote:
But the session expires frequently .please guide on this
Be more specific. Does it time out? Does it simply lose the session when it transfers to another machine in the farm?
Have you synchronised the machine key across the servers? Have you ensured that the IIS Identfier is the same for the website across all servers? Can each of the web servers see the state server?
|
|
|
|
|
|
tejesh123 wrote: Thx for the Soln
That shows either you did not read the reply or you're too ignorant to differentiate between question and comment. If you can not understand such simple reply, I wonder how you will resolve your issue?
You could have simply thanked for the reply and mentioned you look into it, or get back to him later, which shows your gratitude and comprehension.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
|
Thx Abhijit a very nice article on Session state management..
Well i am testing the same for the Web garden getting session timeout.
I also edited the machine.config file for webgarden=true and also set the appropriate cpu mask..
Am i missing something
|
|
|
|
|
Did you gone through the all question that asked by colin?
Does you State Server Process Is running? Database is configure properly ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Sorry to frame wrong question.
My session expires when it tries to jump among CPU's .Yes the state server is configures properly and the database is also working properly.
No issues when no of worker processes set to 1,but soon they are increased it times out.
I have already added state server in web.config and webgarden also set to true in machine.config
It seems to be I am missing out some step ,cant get exactly where..?
|
|
|
|
|
hi,
i have a txt file which is getting updated with records on a server. I am reading the file using a streamreader and filestream, by mapping the drive of the server where the file is getting appended, using asp.net 2005. i am using the following code:
StreamReader reader= new StreamReader(new FileStream(sfilepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 8, FileOptions.Asynchronous));
reader is then passed to a bulkinsert method which inserts the records one by one in the database.
Problem is, sometime duplicate entries gets inserted in the database, but actualy the txt file does not contain duplicate entries.
Sandeep Kumbhar
|
|
|
|
|
Is this being done as a transaction or just row by row inserts?
You could always try to run a select for that record in the db before you decide to insert it.
|
|
|
|