Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

repeater linkbutton to postback to different onItemCommand

Posted on 2004-09-14
7
Medium Priority
?
701 Views
Last Modified: 2008-02-01
hello.

Inside of an asp:repeater, is it possible to postback to a different postback function on mouseClick?  For instance, instead of the following being posted back to "Update_Pick_List", the user could post back to "On_ButtonModelClick" as if the OnItemCommand was listed that way in the asp:repeater tag.
===== code behind=====
Sub On_ButtonModelClick( s As Object, e As RepeaterCommandEventArgs )
...
End Sub

Sub Update_Pick_List( s As Object, e As RepeaterCommandEventArgs )
...
End Sub
=====HTML=====
<asp:Repeater id="rptPickList" Runat="Server" OnItemCommand="Update_Pick_List">
    <ItemTemplate>
        <asp:LinkButton id="update" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PartNo") %>' CommandName='<%# DataBinder.Eval(Container.DataItem, "PartQuantity") %>' Text='update' runat="server" />
        <%-- Is it possible to post back this link to "On_ButtonModelClick"??? --%>
          |  <asp:LinkButton id="update" CommandArgument='<%# Container.DataItem( "modelid" ) %>' CommandName='<%# Container.DataItem( "modelno" ) %> Text='viewModel' runat="server" />
    </ItemTemplate>
</asp:Repeater>

thanks in advance,
~T
0
Comment
Question by:tmihalski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 8

Expert Comment

by:razo
ID: 12062320
well u can only have one function that handles the onitemcommand event
inside this function u can check the id of the button that caused the event and call the function u need
but u need to have different ids for the different linkbuttons
use e.commandname to determine the button clicked
0
 

Author Comment

by:tmihalski
ID: 12064497
right (changed ids below).  This is something like what I'm doing now (detecting linkbutton ids).

On this note, is it possible to "simulate" the passing of RepeaterCommandEventArgs from one sub to another?  For instance (using the below function names), Once inside "Update_Pick_List", detect the linkbutton id, then redirect to On_ButtonModelClick.  I could pass vars to On_ButtonModelClick, but it wouldn't be a RepeaterCommandEventArg.  How would I simulate this?

===== code behind=====
Sub On_ButtonModelClick( s As Object, e As RepeaterCommandEventArgs )
...
End Sub

Sub Update_Pick_List( s As Object, e As RepeaterCommandEventArgs )
...
End Sub
=====HTML=====
<asp:Repeater id="rptPickList" Runat="Server" OnItemCommand="Update_Pick_List">
    <ItemTemplate>
        <asp:LinkButton id="update" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PartNo") %>' CommandName='<%# DataBinder.Eval(Container.DataItem, "PartQuantity") %>' Text='update' runat="server" />
        <%-- Is it possible to post back this link to "On_ButtonModelClick"??? --%>
          |  <asp:LinkButton id="modeldisplay" CommandArgument='<%# Container.DataItem( "modelid" ) %>' CommandName='<%# Container.DataItem( "modelno" ) %> Text='viewModel' runat="server" />
    </ItemTemplate>
</asp:Repeater>
0
 
LVL 8

Expert Comment

by:razo
ID: 12072299
u could pass e from update_pick_list to on_buttonmodelclick. no problem with that
0
 

Author Comment

by:tmihalski
ID: 12075768
ok, that's great.  I do not get an error when I use the following:

On_ButtonModelClick(Me, e)

However, how do I get the values into e when I call the function?  That is my real question.  I am trying things like the following, but I am unsuccessful:

Dim args2 As New CommandEventArgs(myModelNo, myModelId)
CommandEventArgs e = New CommandEventArgs(nothing, args2)
Raise On_ButtonModelClick(Me, e)
0
 
LVL 8

Accepted Solution

by:
razo earned 900 total points
ID: 12082130
if u want to get the commandargumnt of the button
use e.commandargument in ur on_buttonmodelclick
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question