Ask a Question related to ASP.NET General, Design and Development.
-
Marina #1
DataList.DataKeys problem
Hi,
There is a component that is binding the results of a search to a DataList.
By clicking on an image in the datalist, the user can download that
particular item. We are using the DataKeys property to retrieve the ID (as
stored in the database), to then locate the item, and do some other stuff
and push the file out to the user.
The first time the search is performed, the user can download the file, and
the correct file gets downloaded. Let's say there were 10 results
However, the second time the search is done (different criteria), let's say
there were 20 results. Now, the first 10 results, the DataKeys property
returns the ID from the *first* search. For the last 10, the results are
correct.
So it seems the DataKeys property is not getting updated with the new
results, even though a new DataBind is taking place. So all the "extra"
rows, have a new entry in the DataKeys property, and this is correct. But
the first X rows, where X is the number of rows in the first result set, do
not.
Can anyone shed any light on this?
Marina Guest
-
Problem with ItemDAtaBound event of datalist
I have a datalist that displays the following when a web page is rendered: Community_Property: 2 | Corporation: 5 | Custodian: 10 | Individual:... -
DataList Problem???hurry for help!!!
I insert a DataList and a Datagrid in a page: <asp:DataGrid id="DataGrid1" style="Z-INDEX: 103; LEFT: 456px; POSITION: absolute; TOP:... -
Problem with DataGrid inside a DataList
Hi. I have a problem regarding to the DataGrid_ItemDataBound event. I cant run this event when my datagrid is inside a DataList. The... -
DataList Problem
I have a datalist that I subclassed and it has a usercontrol in the header template, in the usercontrol is a databound dropdown. It loads fine and... -
DataKeys in Datagrid
I have a datagrid with a checkbox as one of the column. When the checkboxes are selected and a delete button at the bottom of the grid is clicked,... -
Cristian Suazo #2
Re: DataList.DataKeys problem
Do you have a code snippet I can take a look at?
/Cristian
"Marina" <zlatkinam@nospam.hotmail.com> wrote in message
news:ukptMqGTDHA.560@TK2MSFTNGP10.phx.gbl...DataList.> Hi,
>
> There is a component that is binding the results of a search to a(as> By clicking on an image in the datalist, the user can download that
> particular item. We are using the DataKeys property to retrieve the IDand> stored in the database), to then locate the item, and do some other stuff
> and push the file out to the user.
>
> The first time the search is performed, the user can download the file,say> the correct file gets downloaded. Let's say there were 10 results
>
> However, the second time the search is done (different criteria), let'sdo> there were 20 results. Now, the first 10 results, the DataKeys property
> returns the ID from the *first* search. For the last 10, the results are
> correct.
>
> So it seems the DataKeys property is not getting updated with the new
> results, even though a new DataBind is taking place. So all the "extra"
> rows, have a new entry in the DataKeys property, and this is correct. But
> the first X rows, where X is the number of rows in the first result set,> not.
>
> Can anyone shed any light on this?
>
>
Cristian Suazo Guest
-
Marina #3
Re: DataList.DataKeys problem
I don't think that's really necessary given the description, but here:
Sub DataList_ItemCommand(ByVal sender As Object, ByVal e As
DataListCommandEventArgs)
SendFile(MyList1.DataKeys(e.Item.ItemIndex))
End Sub
SendFile, just uses the key to look up the path of the file and then sends
it.
"Cristian Suazo" <crillus7@hotmail.com> wrote in message
news:ernRU1GTDHA.2020@TK2MSFTNGP11.phx.gbl...stuff> Do you have a code snippet I can take a look at?
>
> /Cristian
>
> "Marina" <zlatkinam@nospam.hotmail.com> wrote in message
> news:ukptMqGTDHA.560@TK2MSFTNGP10.phx.gbl...> DataList.> > Hi,
> >
> > There is a component that is binding the results of a search to a> (as> > By clicking on an image in the datalist, the user can download that
> > particular item. We are using the DataKeys property to retrieve the ID> > stored in the database), to then locate the item, and do some otherBut> and> > and push the file out to the user.
> >
> > The first time the search is performed, the user can download the file,> say> > the correct file gets downloaded. Let's say there were 10 results
> >
> > However, the second time the search is done (different criteria), let's> > there were 20 results. Now, the first 10 results, the DataKeys property
> > returns the ID from the *first* search. For the last 10, the results are
> > correct.
> >
> > So it seems the DataKeys property is not getting updated with the new
> > results, even though a new DataBind is taking place. So all the "extra"
> > rows, have a new entry in the DataKeys property, and this is correct.> do> > the first X rows, where X is the number of rows in the first result set,>> > not.
> >
> > Can anyone shed any light on this?
> >
> >
>
Marina Guest
-
Marina #4
Re: DataList.DataKeys problem
Does that matter what the databind is? The item template being used is not
relevant to the DataKeys property and how that is being populated. If there
are 5 dropdown and 8 labels, or just one checkbox in each item list, the
DataKeys property is being populated exactly the same way regardless.
The databinding code itself, is just:
MyList1.DataSource = GetDataSource()
MyList1.DataBind()
Where GetDataSource just returns a table with the results of the query.
Again, the databinding code is pretty much the only way you can databind, so
I don't think it is helpful.
"Cristian Suazo" <crillus7@hotmail.com> wrote in message
news:O7JhABHTDHA.1912@TK2MSFTNGP12.phx.gbl...I> I understood the description you gave, that was not the issue. I mean thatinteresten> would like to see when the datagrid is called and so on get an overview of
> whats happening... I understand the ItemCommand event, I am moresends> in seeing when you databind and so on....
>
> "Marina" <zlatkinam@nospam.hotmail.com> wrote in message
> news:ONqe13GTDHA.1912@TK2MSFTNGP12.phx.gbl...> > I don't think that's really necessary given the description, but here:
> >
> > Sub DataList_ItemCommand(ByVal sender As Object, ByVal e As
> > DataListCommandEventArgs)
> > SendFile(MyList1.DataKeys(e.Item.ItemIndex))
> > End Sub
> >
> > SendFile, just uses the key to look up the path of the file and thennew> ID> > it.
> >
> > "Cristian Suazo" <crillus7@hotmail.com> wrote in message
> > news:ernRU1GTDHA.2020@TK2MSFTNGP11.phx.gbl...> > > Do you have a code snippet I can take a look at?
> > >
> > > /Cristian
> > >
> > > "Marina" <zlatkinam@nospam.hotmail.com> wrote in message
> > > news:ukptMqGTDHA.560@TK2MSFTNGP10.phx.gbl...
> > > > Hi,
> > > >
> > > > There is a component that is binding the results of a search to a
> > > DataList.
> > > > By clicking on an image in the datalist, the user can download that
> > > > particular item. We are using the DataKeys property to retrieve the> file,> > stuff> > > (as
> > > > stored in the database), to then locate the item, and do some other> > > > and push the file out to the user.
> > > >
> > > > The first time the search is performed, the user can download the> let's> > > and
> > > > the correct file gets downloaded. Let's say there were 10 results
> > > >
> > > > However, the second time the search is done (different criteria),> property> > > say
> > > > there were 20 results. Now, the first 10 results, the DataKeys> are> > > > returns the ID from the *first* search. For the last 10, the results> > > > correct.
> > > >
> > > > So it seems the DataKeys property is not getting updated with thecorrect.> "extra"> > > > results, even though a new DataBind is taking place. So all the> > > > rows, have a new entry in the DataKeys property, and this is> set,> > But> > > > the first X rows, where X is the number of rows in the first result>> >> > > do
> > > > not.
> > > >
> > > > Can anyone shed any light on this?
> > > >
> > > >
> > >
> > >
> >
>
Marina Guest
-
the Dude #5
Re: DataList.DataKeys problem
C'mon Marina,
maybe the young Cristian needs only in wich sub or
function the datagrid databind happens.....
Is it too hard to find?
C'mon Marina
theDude
being used is not>-----Original Message-----
>Does that matter what the databind is? The item templatepopulated. If there>relevant to the DataKeys property and how that is beingitem list, the>are 5 dropdown and 8 labels, or just one checkbox in eachregardless.>DataKeys property is being populated exactly the same wayof the query.>
>The databinding code itself, is just:
>
>MyList1.DataSource = GetDataSource()
>MyList1.DataBind()
>
>Where GetDataSource just returns a table with the resultsyou can databind, so>
>Again, the databinding code is pretty much the only wayissue. I mean that>I don't think it is helpful.
>
>"Cristian Suazo" <crillus7@hotmail.com> wrote in message
>news:O7JhABHTDHA.1912@TK2MSFTNGP12.phx.gbl...>> I understood the description you gave, that was not theget an overview of>I>> would like to see when the datagrid is called and so onI am more>> whats happening... I understand the ItemCommand event,description, but here:>interesten>> in seeing when you databind and so on....
>>
>> "Marina" <zlatkinam@nospam.hotmail.com> wrote in message
>> news:ONqe13GTDHA.1912@TK2MSFTNGP12.phx.gbl...>> > I don't think that's really necessary given theByVal e As>> >
>> > Sub DataList_ItemCommand(ByVal sender As Object,the file and then>> > DataListCommandEventArgs)
>> > SendFile(MyList1.DataKeys(e.Item.ItemIndex))
>> > End Sub
>> >
>> > SendFile, just uses the key to look up the path ofmessage>sends>> > it.
>> >
>> > "Cristian Suazo" <crillus7@hotmail.com> wrote inmessage>> > news:ernRU1GTDHA.2020@TK2MSFTNGP11.phx.gbl...
>> > > Do you have a code snippet I can take a look at?
>> > >
>> > > /Cristian
>> > >
>> > > "Marina" <zlatkinam@nospam.hotmail.com> wrote inof a search to a>> > > news:ukptMqGTDHA.560@TK2MSFTNGP10.phx.gbl...
>> > > > Hi,
>> > > >
>> > > > There is a component that is binding the resultscan download that>> > > DataList.
>> > > > By clicking on an image in the datalist, the userproperty to retrieve the>> > > > particular item. We are using the DataKeysand do some other>> ID>> > > (as
>> > > > stored in the database), to then locate the item,can download the>> > stuff
>> > > > and push the file out to the user.
>> > > >
>> > > > The first time the search is performed, the userwere 10 results>> file,>> > > and
>> > > > the correct file gets downloaded. Let's say there(different criteria),>> > > >
>> > > > However, the second time the search is donethe DataKeys>> let's>> > > say
>> > > > there were 20 results. Now, the first 10 results,last 10, the results>> property>> > > > returns the ID from the *first* search. For theupdated with the>> are>> > > > correct.
>> > > >
>> > > > So it seems the DataKeys property is not gettingplace. So all the>new>> > > > results, even though a new DataBind is takingand this is>> "extra">> > > > rows, have a new entry in the DataKeys property,in the first result>correct.>> > But
>> > > > the first X rows, where X is the number of rows>>> set,>>>> > > do
>> > > > not.
>> > > >
>> > > > Can anyone shed any light on this?
>> > > >
>> > > >
>> > >
>> > >
>> >
>> >
>>
>
>.
>the Dude Guest



Reply With Quote

