From: DavidC on

"Mr. Arnold" wrote:

> DavidC wrote:
> > I do have it set as autopostback in the GridView as shown below. Could I
> > just add the DataKey field to the Check_Clicked function and read it from
> > there? Thanks.
> >
> > <asp:TemplateField HeaderText="Cleared" SortExpression="Reconciled"
> > ItemStyle-BackColor="White" ItemStyle-HorizontalAlign="Center">
> > <ItemTemplate>
> > <asp:CheckBox ID="ckReconciled" runat="server"
> > Checked='<%# Bind("Reconciled") %>' onclick="fillclearedamt(this);"
> > AutoPostBack="True" oncheckedchanged="Check_Clicked" />
> > </ItemTemplate>
> > <ItemStyle BackColor="White" HorizontalAlign="Center" />
> > </asp:TemplateField>
> >
>
> That's autopostback on the Grid control itself needs to be set to true.
> I don't see how an event of the checkbox has any knowledge of an event
> belonging to the Grid. They are two different controls with different
> event arguments.
>
> You need the event that happened on the Grid so that you can get
> e.item.itemindex. E.item.itemindex is a grid control event. You need to
> address a grid event, which should be the Grid_ItemDataBound() event.
>
> You go to the method and do a FindControl("ckReconcile"), and if it
> comes back not null on the find, then you have the hit on the row the
> control is bound in the grid and capture e.itemitemindex (the row),
> which can be saved to a hidden field and used later.
>
> .
>

I am really struggling with this. In my original post I showed how I am
doing this in a ListView and it has been working perfectly. I am confused as
to why the GridView control cannot do the exact same thing. The ListView is
inside an UpdatePanel as is the GridView. The ListView checkbox has
AutoPostback="true" and it runs the event and does exactly what I want and it
gets the datakey value that I need to do my processing. Please let me know
what is different between the 2 controls that I can't do the exact same
thing. Thanks.

David
From: Mr. Arnold on
DavidC wrote:
> "Mr. Arnold" wrote:
>
>> DavidC wrote:
>>> I do have it set as autopostback in the GridView as shown below. Could I
>>> just add the DataKey field to the Check_Clicked function and read it from
>>> there? Thanks.
>>>
>>> <asp:TemplateField HeaderText="Cleared" SortExpression="Reconciled"
>>> ItemStyle-BackColor="White" ItemStyle-HorizontalAlign="Center">
>>> <ItemTemplate>
>>> <asp:CheckBox ID="ckReconciled" runat="server"
>>> Checked='<%# Bind("Reconciled") %>' onclick="fillclearedamt(this);"
>>> AutoPostBack="True" oncheckedchanged="Check_Clicked" />
>>> </ItemTemplate>
>>> <ItemStyle BackColor="White" HorizontalAlign="Center" />
>>> </asp:TemplateField>
>>>
>> That's autopostback on the Grid control itself needs to be set to true.
>> I don't see how an event of the checkbox has any knowledge of an event
>> belonging to the Grid. They are two different controls with different
>> event arguments.
>>
>> You need the event that happened on the Grid so that you can get
>> e.item.itemindex. E.item.itemindex is a grid control event. You need to
>> address a grid event, which should be the Grid_ItemDataBound() event.
>>
>> You go to the method and do a FindControl("ckReconcile"), and if it
>> comes back not null on the find, then you have the hit on the row the
>> control is bound in the grid and capture e.itemitemindex (the row),
>> which can be saved to a hidden field and used later.
>>
>> .
>>
>
> I am really struggling with this. In my original post I showed how I am
> doing this in a ListView and it has been working perfectly. I am confused as
> to why the GridView control cannot do the exact same thing. The ListView is
> inside an UpdatePanel as is the GridView. The ListView checkbox has
> AutoPostback="true" and it runs the event and does exactly what I want and it
> gets the datakey value that I need to do my processing. Please let me know
> what is different between the 2 controls that I can't do the exact same
> thing. Thanks.
>

Maybe, it's due to the Listview has item events and the gridview has row
events that you can get away with it on a Listview what you did. I don't
know.

I forgot what I was doing when the expert sat down with me doing a
hidden field thing on an item within the ItemTemplete to get some other
information I needed, but I could not get to it by any other means using
a RadListView.

It's in the hidden field example that used the Eval in the link. I do
remember on an HTML <TD onClick> that it called a javascript function.
<TD>'s were present in the Itemtemplete of a RadListView.

<TD>
<asp:control />
</TD>


<http://weblogs.asp.net/aghausman/archive/2009/01/08/get-primary-key-on-row-command-gridview.aspx





From: DavidC on

"Mr. Arnold" wrote:

> DavidC wrote:
> > "Mr. Arnold" wrote:
> >
> >> DavidC wrote:
> >>> I do have it set as autopostback in the GridView as shown below. Could I
> >>> just add the DataKey field to the Check_Clicked function and read it from
> >>> there? Thanks.
> >>>
> >>> <asp:TemplateField HeaderText="Cleared" SortExpression="Reconciled"
> >>> ItemStyle-BackColor="White" ItemStyle-HorizontalAlign="Center">
> >>> <ItemTemplate>
> >>> <asp:CheckBox ID="ckReconciled" runat="server"
> >>> Checked='<%# Bind("Reconciled") %>' onclick="fillclearedamt(this);"
> >>> AutoPostBack="True" oncheckedchanged="Check_Clicked" />
> >>> </ItemTemplate>
> >>> <ItemStyle BackColor="White" HorizontalAlign="Center" />
> >>> </asp:TemplateField>
> >>>
> >> That's autopostback on the Grid control itself needs to be set to true.
> >> I don't see how an event of the checkbox has any knowledge of an event
> >> belonging to the Grid. They are two different controls with different
> >> event arguments.
> >>
> >> You need the event that happened on the Grid so that you can get
> >> e.item.itemindex. E.item.itemindex is a grid control event. You need to
> >> address a grid event, which should be the Grid_ItemDataBound() event.
> >>
> >> You go to the method and do a FindControl("ckReconcile"), and if it
> >> comes back not null on the find, then you have the hit on the row the
> >> control is bound in the grid and capture e.itemitemindex (the row),
> >> which can be saved to a hidden field and used later.
> >>
> >> .
> >>
> >
> > I am really struggling with this. In my original post I showed how I am
> > doing this in a ListView and it has been working perfectly. I am confused as
> > to why the GridView control cannot do the exact same thing. The ListView is
> > inside an UpdatePanel as is the GridView. The ListView checkbox has
> > AutoPostback="true" and it runs the event and does exactly what I want and it
> > gets the datakey value that I need to do my processing. Please let me know
> > what is different between the 2 controls that I can't do the exact same
> > thing. Thanks.
> >
>
> Maybe, it's due to the Listview has item events and the gridview has row
> events that you can get away with it on a Listview what you did. I don't
> know.
>
> I forgot what I was doing when the expert sat down with me doing a
> hidden field thing on an item within the ItemTemplete to get some other
> information I needed, but I could not get to it by any other means using
> a RadListView.
>
> It's in the hidden field example that used the Eval in the link. I do
> remember on an HTML <TD onClick> that it called a javascript function.
> <TD>'s were present in the Itemtemplete of a RadListView.
>
> <TD>
> <asp:control />
> </TD>
>
>
> <http://weblogs.asp.net/aghausman/archive/2009/01/08/get-primary-key-on-row-command-gridview.aspx
>
>
>
>
>
> .
>
That link had some good examples. Thank you.

David