|
In my Listview InsertItemTemplate I have the following Label:
<asp:label id="IDNOInsertLabel" runat="server">I use the following VB statement (which works on a Formview) to popuate said Label:
CType(lvPTRPhoneCalls.FindControl("IDNOInsertLabel"), Label).Text = lblSelectedIDNO.Text
It gets an "Oject reference not set to an instance of an object" error.
How/when/where can I popuate a Label in a Listview using VB?
Thank you.
|
|
|
|
|
I'm not sure where the problem might be, but you can rewrite this a bit to help with the debugging.
Dim Obj As Object = lvPTRPhoneCalls.FindControl("IDNOInsertLabel")
If Obj IsNot Nothing Then
Dim Lbl As Label = TryCast(Obj, Label)
If Lbl IsNot Nothing Then
Lbl.Text = lblSelectedIDNO.Text
Else
End If
Else
End If
With this, you can see if the control is not being found, or if it is found but is not a label.
|
|
|
|
|
When I'm executing project in this function this exception rises
private void callbackDoSomeWorkA(IAsyncResult ar) {
string retval = sa.EndDoSomeWorkA(ar);
Stack stack = Session["Status"] as Stack;
stack.Push(retval);
}
WebException was unhandled by user code - The server committed a protocol violation. Section=ResponseStatusLine
what's the problem? Does enybody know it?
C# Developer
modified on Tuesday, March 30, 2010 2:08 PM
|
|
|
|
|
Google gave me this explaination for the error:
the problem is actually caused by the critical http header parsing/validating
of the HttpWebRequest component. According to the Http
Specification(http1.1), the HTTP header keys shoud specifically not include
any spaces in their names. However, some web servers do not fully respect
standards they're meant to. Applications running on the Dotnet framework
and making heavy use of http requests usually use the httpWebRequest class,
which encapsulates everything a web oriented developer could dream of. With
all the recently issues related to security, the "httpWebRequest" class
provides a self protection mechanism preventing it to accept HTTP answers
which not fully qualify to the specifications.
The common case is having a space in the "content-length" header key. The
server actually returns a "content length" key, which, assuming no spaces
are allowed, is considered as an attack vector (HTTP response split
attack), thus, triggering a "HTTP protocol violation error" exception.
Setting this would help:
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
</configuration>
Detailed link by Microsoft support[^]
UPDATE: Also look at this link... this too involves above config but states some changes in Port!
http://channel9.msdn.com/forums/TechOff/257803-HttpWebRequestResponse-The-server-committed-a-protocol-violation-SectionResponseStatusLine/[^]
modified on Tuesday, March 30, 2010 1:10 PM
|
|
|
|
|
I've done like this...
but is is same error
C# Developer
|
|
|
|
|
In my Listview I have the following Label in the <inserrtitemtemplate>
|
|
|
|
|
Can you please edit and make the formatting correct. Its hard to read right now!
MarkPhD wrote: "Object reference not set to an instance of an object" error.
Based on this, it means that there is some problem at this line of yours:
CType(lvPTRPhoneCalls.FindControl("IDNOInsertLabel"), Label).Text
For now, looks like a bracket missing.... try this:
(CType(lvPTRPhoneCalls.FindControl("IDNOInsertLabel"), Label)).Text
P.S.: Assuming the control exists in 'lvPTRPhoneCalls'... thus CType(lvPTRPhoneCalls.FindControl("IDNOInsertLabel"), Label) is not null !
|
|
|
|
|
Hi Friends..
I am using Asp.Net c# one of my project, there i am using QueryString to pass value from one page to another page as (www.xyz.com?a=old#10),
value=Request.QueryString["prd"]
the problem is that IE6 taken value=old#10 where is all browser taken value=old kindly help me i need only old .
|
|
|
|
|
Have you tried to encode the url
Server.URLEncode('www.xyz.com?a=old#10");
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Solve by string.replace(IndexOf)
|
|
|
|
|
How did this solve your issue?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I think he did substring from the start to the index of '#' sign... ... otherwise we need to learn the programming again... 
|
|
|
|
|
hi sir,
i am new in asp.net.sir i want to know that is there any java script with the help of which we can stop page reloading at the time of using ajax control.and dropdown text selection.
sir i know that update panel can do this.but sir i do not want to use update panel.i mean i want to stop my page reload without using update panel while i am using ajax.
please help me sir i am posting my this question again.
because first time i did not get any response.
|
|
|
|
|
Ajax is an out of band technology that does not require your page to reload. There are many, many examples for Ajax here and elsewhere.
One thing to make sure to do is set AutoPostback to false on your dropdownlist so it does not postback
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Do you have a reason you don't want to use an update panel?
Your question is like asking about getting a nail into a piece of wood but refusing to use a hammer. When you make silly restrictions with no reasons behind them you are less likely to get help because you might dismiss other good solutions for no apparant reason as well.
|
|
|
|
|
I would disagree. There are plenty of good reasons to not use an UpdatePanel. Refreshing a portion of a page does not require one to be used and it does add extra overhead that may not be necessary.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Of course. A nail doesn't require a hammer either. You could use a rock. And you can just pick up a rock without the overhead of a mining and smelting operation for the metal part of a hammer. But if I have a hammer and a rock on my work table, I am probably going to use the hammer. And if someone comes into my workshop and declares "no hammers allowed" for no apparant reason I will dismiss them as a nut and tell them to go away.
The overhead is usually minimal when compared to the complexity and maintainability issues of most of the alternatives for someone who is new to ASP.Net as the asker stated.
But we can let the asker decide. The following article discusses some of the trade-offs and alternate methods. UpdatePanel Tips and Tricks[^]
|
|
|
|
|
Ok my friend thats too much use of "Sir" in your post... 
|
|
|
|
|
|
Lets assume you have a combo box called cmbList and 3 label lblDisplayText , lblDisplayValue , lblSelectedIndex on the page. use the following script to get the value and fill the labels...
window.onload = function(){
var list = document.getElementById("cmbList");
list.onchange = function(){
document.getElementById("lblDisplayText").value = list.options[list.selectedIndex].text;
document.getElementById("lblDisplayValue").value = list.options[list.selectedIndex].value;
document.getElementById("lblSelectedIndex").value = list.selectedIndex;
}
}
to make sure you can remove commented code.
|
|
|
|
|
Hi to all,
I know its a common question. But I want to share something. Actually I am working on e-commerce portal. It consists of 32000 products with around 2500 categories. I used 3-tier architecture for this project. Everything is coming using stored procedures. I used master pages as well.
But still I am fighting with the performance issue. Can anyone please tell me some useful steps to increase the speed of the website. Its taking ages to load the pages.
waiting for your assistance....
cheers,
sneha
|
|
|
|
|
First question might be: are you loading all of the records into a grid at startup? Perhaps you should look at only loading an appropriate subset of records.
You could also look at caching data and settings that don't change very often.
There are also a couple of articles on CP (you'll have to find them for yourself) which give good tips on how to optimise your application.
You could also use analysis tools (like Fiddler) to see what the application is doing or analyse the stored procedures; look at the explain plans and try to speed them up. Do they have the correct/any indexes?
That barely scrathces the surface and is a guess about your needs: you should be more specific about where the bottlenecks are occurring but should get you started.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
In addition to other ideas I would suggest to fire up a profiler like the one from redgate (ants profiler it is, i believe) to see what takes so long to render your page.
When in trouble,
when in doubt,
run in circles,
scream and shout
|
|
|
|
|
Agree with digital man. First thing to look at is SQL.
Also, does the site have images for the products? Are these optimized? How are they handled? Are you storing in db?
Need to see some code to help more...
|
|
|
|
|
what about caching ? and how long takes a page to render?
|
|
|
|