|
Hi All
I use the datalist control on my page used to display the value of database now some of the value are blank("") so i want to check for the same and if the value is blank or null then i want to change the color for that cell is yellow.
i got the follwoing it its not work. plz reply what is incorrect with that and what i have to do to find the solution i mentioned above.
<br />
<br />
Label l1 = e.Item.FindControl("Correct_AnswerLabel").;<br />
Response.Write(l1.Text);<br />
<br />
<br />
<br />
With Regards
Yogesh Agarwal
|
|
|
|
|
Dont you need an if statement to check if its blank
if(value == "")
{
}
else
{
}
|
|
|
|
|
Thanks for Reply
Yes it has to done but first i have to fetch the value to compare, the problem is in fetching the the once it come then only i could compare it
with regards
Yogesh Agarwal
|
|
|
|
|
Im getting error in compare place of datareader value and string value;
That i mentioned in bold letters:
Error Msg:The name 'dr' does not exist in the current context
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
{
bool boolReturnValue = false;
string strConnection = "server=(local);Database=WorkOut;User ID=sa;Password=bumi";
SqlConnection Connection = new SqlConnection(strConnection);
string strSQL = "Select User,pwd From Main";
SqlCommand command = new SqlCommand(strSQL, Connection);
SqlDataReader Dr;
Connection.Open();
Dr = command.ExecuteReader();
while (Dr.Read())
{
if ((UserName == dr[0].ToString()) & (Password == dr[1].ToString()))
{
boolReturnValue = true;
}
Dr.Close();
return boolReturnValue;
}
}
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
You may want to the use Equals() method of the string class, as that will compar the value of the two strings not the reference.
|
|
|
|
|
The == operator is overridden for strings to call the Equals method. This is done so that you can use the == operator for strings, so there is no reason not to.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Change first letter to upper of datareader in your if condition.
.<br />
.<br />
.<br />
if ((UserName == Dr[0].ToString()) & (Password == Dr[1].ToString()))<br />
{<br />
<br />
boolReturnValue = true;<br />
<br />
}<br />
.<br />
.<br />
.
I Love T-SQL
|
|
|
|
|
How to handel this(The channel 'tcp' is already registered.) Exception in remoting
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Can you a bit more specific, what are you trying to do?
|
|
|
|
|
i am working on remoting (server, clinte, object) first time when i conect clinte to server then its work properly. ofter that whn i diconect the ser clint and again try to connect client to server then its give error(The channel 'tcp' is already registered) without closing the application. if i close the application and again try then it work properly.
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
ok still properly didnt understand but maybe you should try automatically closing the app after each connection
|
|
|
|
|
problem is that without closing the apllication i conect and disconect on buttum then it give the error
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
maybe close the app on the button instead
or can you psot some of your code so we can see what is happening
|
|
|
|
|
CLient
Dim serverProv As New BinaryServerFormatterSinkProvider
serverProv.TypeFilterLevel = Runtime.Serialization.Formatters.TypeFilterLevel.Full
Dim clientProv As New BinaryClientFormatterSinkProvider
'Dim props As IDictionary = New Hashtable
props = New Hashtable
props("port") = 0
RemoteChannel = New TcpChannel(props, clientProv, serverProv)
ChannelServices.RegisterChannel(RemoteChannel, True)
RODemo = Activator.GetObject(GetType(RemoteObject.DemoObject), "tcp://localhost:40011/Test")
Dim mRemoteObjectEventHelper As New RemoteObject.RemoteObjectEventHelper(RODemo)
AddHandler mRemoteObjectEventHelper.RemoteStatusObjectEvent, AddressOf HandleTheEvent
Server
BotCollection = New Collection()
Dim serverProv As New BinaryServerFormatterSinkProvider
serverProv.TypeFilterLevel = Runtime.Serialization.Formatters.TypeFilterLevel.Full
Dim clientProv As New BinaryClientFormatterSinkProvider
'Dim props As IDictionary = New Hashtable
props = New Hashtable
props.Remove("port")
props("port") = 40011
RemoteChannel = New TcpChannel(props, clientProv, serverProv)
ChannelServices.RegisterChannel(RemoteChannel, True)
RemotingConfiguration.RegisterWellKnownServiceType(GetType(RemoteObject.DemoObject), "Test", WellKnownObjectMode.Singleton)
RODemo = Activator.GetObject(GetType(RemoteObject.DemoObject), "tcp://localhost:40011/Test")
RODemo.Initiator = "Server"
Dim mRemoteObjectEventHelper As New RemoteObject.RemoteObjectEventHelper(RODemo)
AddHandler mRemoteObjectEventHelper.RemoteObjectEvent, AddressOf HandleTheEvent
AddHandler mRemoteObjectEventHelper.RemoteSDObjectEvent, AddressOf ShutHandleTheEvent
AddHandler mRemoteObjectEventHelper.RemoteStatusObjectEvent, AddressOf FindBotStatusEvent
AddHandler mRemoteObjectEventHelper.RemotegetStatusObjectEvent, AddressOf getBotStatusEvent
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Hi peeps
I know loads of you have probably seen this error, or read about it before - so this shouldn't be a problem to answer.
I can connect and see my database (which is on my local machine) in Visual Studio (I am uing LINQ to connect and auto-generate entity classes). When I run my application it comes back with the dreadful error:
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
Now I've done everyting you are supposed to do:
1) Ensured remote connections are enabled, enabled TCP and named pipes
2) Started Browser service
3) Restarted servcies and/or Rebooted machine
4) Windows firewall isn't running as I have Kaspersky - but i've put in exceptions for the processes; and even turned Kaspersky off.
No joy.
As Visual Studio can connect and view the database, i was wondering if there is anything I have to configure on the ASP.net side of things?
I should point out that I am running:
- Vis Studio 2008
- Sql Server 2005 Service pack 2
- Vista business (incidentally I had no problems with the same set-up on diff machine running Vista Ultimate)
|
|
|
|
|
I had this problem when I tried to connect from a server outside my local network to a server inside my local network
Are both the servers that are trying to talk to each other inside the same network?
Can you ping the address of the server you are trying to conenct to?
|
|
|
|
|
morning mate,
Yeah its all on my local machine
I had the same error on a diff machine connecting to a remote db, but sorted that by using the correct connection string.
This time, vis studio auto gens the connection string, which works in the designer, but not at run-time.
Hmmmmmmm
|
|
|
|
|
Daniel Fowler wrote: This time, vis studio auto gens the connection string,
That would suggest that you need to write the connection string yourself, make sure all the basics are correct like username etc and also try using the name of the server instead of IP or viceversa
|
|
|
|
|
Yeah, I'll have to try that.
It's just funny how this worked without a problem on my other machine running Ultimate.
Damn computers, I knew I should have been a carpenter.
|
|
|
|
|
Hello all,
I am displaying a calender in pop window. I am having a form which is in user control and that form having calender control. I am using the user control on another page and the form get displayed.When user click on calender image a pop open and i am displaying calender control in pop up window.When user select a date then selected date will get displayed in text box. The problem is that when i click on a date in calender control then date will not get displayed in calender control and it gives following error.
Error: window.opener.document.forms[0].txtdelivdate has no properties<br />
Source File: http:
Line: 48
when i find out the cause then i found that user control dosenot have form tag so it gives the error. when i add the form tag in user control then it shows error.
a page can have only one form tag
because the page on which i am displaying user control having form tag. I cant remove the form tag on my aspx page. So how can i solve the error.
i am adding folowing code for adding on calendr selected index changed event to add calender selected value to text box.
Dim strScript As String = "<script>window.opener.document.forms[0]." + control.Value + ".value = '"<br />
strScript += calDate.SelectedDate.ToString("MM/dd/yyyy")<br />
strScript += "';self.close()"<br />
strScript += "<br />
RegisterClientScriptBlock("anything", strScript)</script>
Please help me.
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|
|
Does the View Source show txtdelivdate as it is or is the name mangled?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
No is shows as it is? if i put the textbox and image on the same page it running properly. But it is in user control so at that time it gives above error in javascript console.
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|
|
Hi, in my application i have 3 master pages, in the child page, i need to am call one javascript function on page load, for intialize some values, i have used "Register client script", but there is no use, can one pull me out?
Thanks & regards
Murty
|
|
|
|
|
dwadasi wrote: but there is no use
Can you quantify the situation? Are you getting any errors? Do you see the script emitted as part of the HTML?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Use RegisterStartupScript rather than RegisterClientScript.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|