|
One possible problem you are running into is the click location is in one of your user controls constituent controls because the user control might not have any actual screen area that is not occupied by a constituent. If they are asp controls you should be able to capture the constituent control OnClick events.
However I still suggest you study the subject by digging into that first search result item and/or some of the others. It's always better to have a solid understanding of what you are about to use.
led mike
|
|
|
|
|
I need a little help with some code I'm working on. I have a Datalist control that is throwing the following expeption.
------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
------------------------------------------------------------------------
Here is my code.
<br />
Sub Edit_Command(ByVal sender As Object, ByVal e As DataListCommandEventArgs) Handles DataList.EditCommand<br />
<br />
DataList.EditItemIndex = CType(e.Item.ItemIndex, Integer)<br />
<br />
Dim strDate As String = ""<br />
Dim strAssignments As String = ""<br />
Dim strSchool As String = ""<br />
Dim strProgramme As String = ""<br />
Dim strSubject As String = ""<br />
Dim strCity As String = ""<br />
Dim strState As String = ""<br />
Dim strReason As String = ""<br />
<br />
Dim reader As SqlDataReader<br />
Dim cmd As New SqlCommand("SELECT * FROM tblVolDeclinedMissedCanceledAssignments WHERE VolunteerId=" & VolunteerId() & " AND Id=" & e.CommandArgument, cn)<br />
cmd.CommandType = Data.CommandType.Text<br />
<br />
Try<br />
cn.Open()<br />
reader = cmd.ExecuteReader()<br />
<br />
While reader.Read<br />
strDate = IIf(IsDBNull(reader("Date")), "", reader("Date"))<br />
strAssignments = IIf(IsDBNull(reader("Assignment")), "", reader("Assignment"))<br />
strSchool = IIf(IsDBNull(reader("SchoolVenue")), "", reader("SchoolVenue"))<br />
strProgramme = IIf(IsDBNull(reader("Programme")), "", reader("Programme"))<br />
strSubject = IIf(IsDBNull(reader("Subject")), "", reader("Subject"))<br />
strCity = IIf(IsDBNull(reader("City")), "", reader("City"))<br />
strState = IIf(IsDBNull(reader("StateProvince")), "", reader("StateProvince"))<br />
strReason = IIf(IsDBNull(reader("Reason")), "", reader("Reason"))<br />
End While<br />
<br />
Catch ex As Exception<br />
Throw New ApplicationException(ex.Message)<br />
Finally<br />
cn.Close()<br />
End Try<br />
<br />
CType(e.Item.FindControl("rdpEditDate"), Telerik.WebControls.RadDatePicker).SelectedDate = strDate<br />
CType(e.Item.FindControl("ddlEditAssignments"), DropDownList).SelectedValue = strAssignments<br />
CType(e.Item.FindControl("txtEditSchoolVenue"), TextBox).Text = strSchool<br />
CType(e.Item.FindControl("ddlEditProgramme"), DropDownList).SelectedValue = strProgramme<br />
CType(e.Item.FindControl("ddlEditSubject"), DropDownList).SelectedValue = strSubject<br />
CType(e.Item.FindControl("txtEditCity"), TextBox).Text = strCity<br />
CType(e.Item.FindControl("ddlEditStateProvince"), DropDownList).SelectedValue = strState<br />
CType(e.Item.FindControl("txtEditReason"), TextBox).Text = strReason<br />
'Me.ddlEditAssignments.Items.FindByText(reader("Assignment")).Selected = True<br />
<br />
LoadDataMSCAData()<br />
End Sub<br />
The exception is thrown as soon as I hit the lines at the bottom where I am trying to assign the values from the datareader to the controls in the EditItemTemplate of the Datalist. What is really wierd about this is that I am using the exact same syntax to find the controls in my update command (below), and it works just fine.
Update Command:
<br />
Protected Sub DataList_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList.UpdateCommand<br />
<br />
Dim arg As String = e.CommandArgument<br />
<br />
Dim strDate As String = CType(e.Item.FindControl("rdpEditDate"), Telerik.WebControls.RadDatePicker).SelectedDate.ToString<br />
Dim strAssignment As String = CType(e.Item.FindControl("ddlEditAssignments"), DropDownList).SelectedValue<br />
Dim strSchoolVenue As String = CType(e.Item.FindControl("txtEditSchoolVenue"), TextBox).Text<br />
Dim strProgramme As String = CType(e.Item.FindControl("ddlEditProgramme"), DropDownList).SelectedValue<br />
Dim strSubject As String = CType(e.Item.FindControl("ddlEditSubject"), DropDownList).SelectedValue<br />
Dim strCity As String = CType(e.Item.FindControl("txtEditCity"), TextBox).Text<br />
Dim strStateProvince As String = CType(e.Item.FindControl("ddlEditStateProvince"), DropDownList).SelectedValue<br />
Dim strReason As String = CType(e.Item.FindControl("txtEditReason"), TextBox).Text<br />
<br />
Dim sql As String<br />
<br />
Try<br />
sql = "UPDATE tblVolDeclinedMissedCanceledAssignments " & _<br />
"SET Date=@Date, Assignment=@Assignment, SchoolVenue=@SchoolVenue, Programme=@Programme, Subject=@Subject, City=@City, StateProvince=@StateProvince, Reason=@Reason " & _<br />
"WHERE VolunteerId=" & Me.VolunteerId & " AND Id=" & e.CommandArgument<br />
<br />
Dim cmd As New SqlCommand(sql, cn)<br />
cmd.Parameters.AddWithValue("@Date", strDate)<br />
cmd.Parameters.AddWithValue("@Assignment", strAssignment)<br />
cmd.Parameters.AddWithValue("@SchoolVenue", strSchoolVenue)<br />
cmd.Parameters.AddWithValue("@Programme", strProgramme)<br />
cmd.Parameters.AddWithValue("@Subject", strSubject)<br />
cmd.Parameters.AddWithValue("@City", strCity)<br />
cmd.Parameters.AddWithValue("@StateProvince", strStateProvince)<br />
cmd.Parameters.AddWithValue("@Reason", strReason)<br />
cn.Open()<br />
<br />
cmd.ExecuteNonQuery()<br />
<br />
Catch ex As Exception<br />
Throw New Exception<br />
Finally<br />
cn.Close()<br />
End Try<br />
<br />
DataList.EditItemIndex = -1<br />
LoadDataMSCAData()<br />
<br />
End Sub<br />
I have allreay read a bunch of forums and articals and can't figure out what I missing. If anyone here could tell me what I'm missing that would be great.
Thanks,
-Adam N. Thompson
|
|
|
|
|
I have my application migrated to VS2005 from VS2003, and the database is on MS SQL 2005.
I have couple of pages that have dynamic datagrids. When I run the application from within VS, it runs faster, loads the dynamic grid page faster than it does when I run outside of VS environment.
What causes it to run slower, outside the VS environment? How can I improve performance?
Thank You
Hashok
|
|
|
|
|
|
It's an entry page .. like Emp..
when I go to run .. there's some Textbox fields defined with a yellow back color ....
how can I prevent that ..
jooooo
|
|
|
|
|
kindman_nb wrote: It's an entry page .. like Emp..
when I go to run .. there's some Textbox fields defined with a yellow back color ....
Do you have the Google toolbar installed with the AutoFill feature switched on?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
Hi,
I need a Prompt With Password Type.
var x = prompt("Enter in the password"," ")
This code proompt and ask for a password but it will apperar as text , but i want it as a password.
Is it possible ?
<br />
if(yes)<br />
how ?<br />
else<br />
Any Idea !!
Thanks in advance !!!
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
You would have to develop a custom page with the appearance of a dialog box. Then you could use an INPUT tag of type 'password' to collect the user's password.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hey!
Thanks for the previous reply!
I have created a web scheduling system which will be used internally(intranet). Now, I am trying to sync the outlook calendar of the user and the web application. For example, if the user uses the web application to create a new appointment or edits the appointment, the web application is supposed to send an update to the outlook calendar. I am using the active directory credentials to get users to log in to my application.
My question is, how should I approach this problem. I have got no idea on how to get started . Hope some of you can give me suggestions on how to get started.
Thanks in advance!!!
|
|
|
|
|
Are you working with Exchange Server Also??
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
I am not directly working with exchange server. If I have to work with the exchange server, it would take some time to get permissions.
So looking for alternatives.
Thanks
|
|
|
|
|
Hi
I have the following to urls, one is in asp hyperlink the other just a normal hyperlink, whwne I use the asp one it says "The server tag is not well formed"
When I use the normal a href it works, why would this be?
thanks!
<asp:HyperLink NavigateUrl="Page.aspx?qtynewvar=<%# Eval("Value") %>&stringname=<%# Eval("Value") %>&stringname=<%# Eval("Value")%>" Text="<%# Eval("Value") %>" runat="server">
</asp:HyperLink>
<a href="Page.aspx?qtynewvar=<%# Eval("Value") %>&stringname=<%# Eval("Value") %>&stringname=<%# Eval("Value")%>" Text="<%# Eval("Value") %>"><%# Eval("Qty_New") %></a>
</ItemTemplate>
|
|
|
|
|
Still having problems using Google[^] I see. Who ever told you that you don't need to learn how to research information to develop software was wrong, don't listen to them.
led mike
|
|
|
|
|
Still an obnoxious programmer I see, don't worry one day you will get a life
in regards to your google quip I thought because this forum is designed for programmers to help each other I might be able to get an answer. I have tried google but can't find the apporpraite solution.
|
|
|
|
|
.netman wrote: Still an obnoxious programmer
At least I can do my job. Just in case you are interested I provided you a link that will help you learn what your error message means. That should in turn help you solve your problem yes?
led mike
|
|
|
|
|
OK the link was useless, I know what well formed means I just wondered if anyone knew the correct syntax to put variables into the hyperlink field .
You may have seen that I have posted help to other so I expected someone to maybe help me, that is why I posted on this forum.
|
|
|
|
|
I don't use inline server code like that, I think it's garbage. I would use code behind to generate the URL string and assign the value to the controls property.
Anyway, this might help you.[^]
led mike
|
|
|
|
|
This gets a bit convoluted. you cant use " for the attribute and " inside the Eval statement.You also cant use Eval twice like that in a server tag.
Lets hit those 2 things one at a time:
Text="<%# Eval("Value") %>"
must be
Text='<%# Eval("Value") %>'
note the use of ' for the attribute - this allows you to use the " in the Eval statement.
For the other one, you have to evaluate the whole link at runtime so:
NavigateUrl="Page.aspx?qtynewvar=<%# Eval("Value") %>&stringname=<%# Eval("Value") %>&stringname=<%# Eval("Value")%>"
must become:
NavigateUrl='<%# "Page.aspx?qtynewvar=" + Eval("Value") + "&stringname=" + Eval("Value") + "&stringname="+ Eval("Value") %>'
(again, note the use of ' for the attribute)
oh, and I as much as I tell people to use google when they are lazy, IMO this is one of those weirdnesess that you just pick up through experience. However, as always if you google the exact error message you will find the answer!
|
|
|
|
|
Great answer thanks that worked!
Just what I was looking for.
cheers
|
|
|
|
|
Hi everyone,
I need to create runtime RadioButtons with C#, and I want to set the width of the label (or of the entire control).
This way it's not working:
RadioButton rdb = new RadioButton();
rdb.Width=300;
Suggestions?
What am I doing wrong?
Thanks!
|
|
|
|
|
Have you tried setting the AutoSize property of the RadioButton to false?
By your code, I'm assuming you're not using ASP .Net, and that you are using C#; if that is the case, you might want to put this question in the C# forum next time. Otherwise, I apologize for my assumption.
I hope this helps.
|
|
|
|
|
Okk...I'm using C#, you're right but I'm developing a web application, so I thought it was better to post here, otherwise i could have got an answer about windows applications...
Yes, I tried to change the autosize to false, but it didn't work...
Don't know what I have to think...
Anyway, Thanks!
|
|
|
|
|
I apologize for my assumption; you've posted in the right area.
If you look at the source code in HTML after ASP .Net creates the radio buttons, it actually creates two HTML elements, an <input> tag (which creates the button) and a <label> tag (that contains the text linked to the button). You will most likely have to find a way to get CSS attached to the <label> element.
I hope this helps.
|
|
|
|
|
Its been a long time been out of touch with .NET and C# for me, and am trying to come back.
I remember having worked with RESX files in ASP however not sure when was this feature introduced?
Was it ASP .NET 1.1 or 2.0?
Help is appreciated!
------------------------------------
Vision is the ability to see the invisible
|
|
|
|