Re: Controls inside EditTemplate cause editing to end
- From: "Nathan Sokalski" <njsokalski@xxxxxxxxxxx>
- Date: Thu, 8 Sep 2005 03:04:13 -0400
I would like to set a breakpoint in Visual Studio to find the undesired
call, but unfortunately the site is on a remote server and according to the
person in charge of the server (who is also the person who taught me
ASP.NET) the server's ability to do debugging remotely has been turned off.
--
Nathan Sokalski
njsokalski@xxxxxxxxxxx
http://www.nathansokalski.com/
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:O0TCm5BtFHA.1168@xxxxxxxxxxxxxxxxxxxxxxx
> Nathan,
>
> You've got the solution at hand. You need to identify the undesired
> call(s) to RefreshEvents() and put the If Then there.
>
> That's really the only way to do it. If you're using Visual Studio now is
> the time to set a breakpoint and see exactly what your code is doing...
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "Nathan Sokalski" <njsokalski@xxxxxxxxxxx> wrote in message
> news:%23gtBVsAtFHA.2592@xxxxxxxxxxxxxxxxxxxxxxx
>>I think you misunderstood what I meant. If I were to use the If Then like
>>you said, the If Then would have to go inside my RefreshEvents() method,
>>since that is the only place that I know is getting called during the
>>"undesired" databinding. However, if I did that, it would affect the
>>databinding when I don't want it to just like when I had the problem
>>before. If I knew where the "undesired" databinding was being called from
>>(in other words, what method calls RefreshEvents() when I don't want it
>>to) I could put the If Then there, but I don't know where that is. Another
>>solution, if it exists, would be to use an If Then with a condition based
>>on what method was calling it. Any ideas? Thanks.
>> --
>> Nathan Sokalski
>> njsokalski@xxxxxxxxxxx
>> http://www.nathansokalski.com/
>>
>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
>> message news:uF$DqQ$sFHA.1704@xxxxxxxxxxxxxxxxxxxxxxx
>>> Leave the if then and then call the binding code when you need to from
>>> those methods.
>>>
>>> --
>>> Sincerely,
>>>
>>> S. Justin Gengo, MCP
>>> Web Developer / Programmer
>>>
>>> www.aboutfortunate.com
>>>
>>> "Out of chaos comes order."
>>> Nietzsche
>>> "Nathan Sokalski" <njsokalski@xxxxxxxxxxx> wrote in message
>>> news:O6pUUK$sFHA.464@xxxxxxxxxxxxxxxxxxxxxxx
>>>> My DataList's EnableViewState property is set to True. I have tried
>>>> wrapping my binding code in an If Not IsPostBack Then statement like
>>>> you said, but that causes the binding to not occur at other times when
>>>> it does need to happen. I have a method that contains my binding code
>>>> which I call in my Page_Init method as well as after I make any changes
>>>> to the database I use as my datasource. This method is as follows:
>>>>
>>>> Private Sub RefreshEvents()
>>>>
>>>> Dim events As New DataSet
>>>>
>>>> Dim myconnection As New
>>>> OracleConnection(System.Configuration.ConfigurationSettings.AppSettings("connectionString"))
>>>>
>>>> Dim cmdselect As New OracleCommand("SELECT * FROM eventlist WHERE
>>>> eventdate<TO_DATE('" & Date.Now.ToShortDateString() &
>>>> "','MM/DD/YYYY')", myconnection)
>>>>
>>>> Dim cmddelete As New OracleCommand("", myconnection)
>>>>
>>>> Dim eventsadapter As New OracleDataAdapter(cmdselect)
>>>>
>>>> 'Delete any past events and the people who registered for them
>>>>
>>>> eventsadapter.Fill(events, "eventlist")
>>>>
>>>> If events.Tables("eventlist").Rows.Count <> 0 Then
>>>>
>>>> For Each pastevent As DataRow In events.Tables("eventlist").Rows
>>>>
>>>> cmddelete.CommandText = "DELETE FROM registered WHERE eventid=" &
>>>> pastevent.Item("eventid")
>>>>
>>>> myconnection.Open()
>>>>
>>>> cmddelete.ExecuteNonQuery()
>>>>
>>>> cmddelete.CommandText = "DELETE FROM eventlist WHERE eventid=" &
>>>> pastevent.Item("eventid")
>>>>
>>>> cmddelete.ExecuteNonQuery()
>>>>
>>>> myconnection.Close()
>>>>
>>>> If pastevent.Item("details") <> "" AndAlso
>>>> System.IO.File.Exists(Server.MapPath("eventdetails/" &
>>>> pastevent.Item("details"))) Then
>>>> System.IO.File.Delete(Server.MapPath("eventdetails/" &
>>>> pastevent.Item("details")))
>>>>
>>>> Next
>>>>
>>>> End If
>>>>
>>>> 'Fill DataSet with all remaining events
>>>>
>>>> events.Clear()
>>>>
>>>> cmdselect.CommandText = "SELECT * FROM eventlist ORDER BY eventdate"
>>>>
>>>> eventsadapter.SelectCommand = cmdselect
>>>>
>>>> eventsadapter.Fill(events, "eventlist")
>>>>
>>>> datEditEvents.DataSource = events
>>>>
>>>> datEditEvents.DataBind()
>>>>
>>>> ddlDeleteEvents.Items.Clear()
>>>>
>>>> For Each existevent As DataRow In events.Tables("eventlist").Rows
>>>>
>>>> ddlDeleteEvents.Items.Add(New
>>>> ListItem(CDate(existevent("eventdate")).ToShortDateString() & " " &
>>>> existevent("eventname"), existevent("eventid")))
>>>>
>>>> Next
>>>>
>>>> End Sub
>>>>
>>>>
>>>> Any other ideas? If you would like to see any of the other code I use,
>>>> just let me know. Thanks.
>>>> --
>>>> Nathan Sokalski
>>>> njsokalski@xxxxxxxxxxx
>>>> http://www.nathansokalski.com/
>>>>
>>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
>>>> message news:uX0KCh9sFHA.3604@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> Nathan,
>>>>>
>>>>> Make certain that your DataList control has it's viewstate property
>>>>> set to true and then, wherever in your code you are binding the
>>>>> DataList, wrap that code in:
>>>>>
>>>>> If Not IsPostBack Then
>>>>> '---Bind your DataList here.
>>>>> End If
>>>>>
>>>>> I don't know exactly where you are doing your databinding, but from
>>>>> what you describe I think you have identified your problem correctly.
>>>>> Your DataList is getting re-bound on postback.
>>>>>
>>>>> By the way, please don't post to more than one newsgroup at a time...
>>>>>
>>>>>
>>>>> --
>>>>> Sincerely,
>>>>>
>>>>> S. Justin Gengo, MCP
>>>>> Web Developer / Programmer
>>>>>
>>>>> www.aboutfortunate.com
>>>>>
>>>>> "Out of chaos comes order."
>>>>> Nietzsche
>>>>> "Nathan Sokalski" <njsokalski@xxxxxxxxxxx> wrote in message
>>>>> news:%23vIrGb9sFHA.460@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>>I have a DataList control with an EditTemplate. Three of the controls
>>>>>>in this template include a Calendar, a Button with
>>>>>>CommandName="update", and a Button with CommandName="cancel". Whenever
>>>>>>I click one of these controls, the DataList replaces the EditTemplate
>>>>>>with the ItemTemplate. I think this is because the method I wrote
>>>>>>which performs the databinding is getting called, but I don't know why
>>>>>>or where it is getting called from. It does not get called from my
>>>>>>Page_Load method and I do not have an ItemCommand event handler, so I
>>>>>>don't know where to start testing for it. I tested to see if my
>>>>>>UpdateCommand event is getting called when I click the Button with
>>>>>>CommandName="update" by assigning some text to a Label control, so I
>>>>>>know that it is never getting called. What could be causing my
>>>>>>problem? Any help would be appreciated. Thanks.
>>>>>> --
>>>>>> Nathan Sokalski
>>>>>> njsokalski@xxxxxxxxxxx
>>>>>> http://www.nathansokalski.com/
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
.
- Follow-Ups:
- Re: Controls inside EditTemplate cause editing to end
- From: S. Justin Gengo
- Re: Controls inside EditTemplate cause editing to end
- References:
- Re: Controls inside EditTemplate cause editing to end
- From: S. Justin Gengo
- Re: Controls inside EditTemplate cause editing to end
- From: Nathan Sokalski
- Re: Controls inside EditTemplate cause editing to end
- From: S. Justin Gengo
- Re: Controls inside EditTemplate cause editing to end
- From: Nathan Sokalski
- Re: Controls inside EditTemplate cause editing to end
- From: S. Justin Gengo
- Re: Controls inside EditTemplate cause editing to end
- Prev by Date: http://localhost
- Next by Date: HELP on building web page content ????
- Previous by thread: Re: Controls inside EditTemplate cause editing to end
- Next by thread: Re: Controls inside EditTemplate cause editing to end
- Index(es):