Onclick for the itemrenderer button control

Hi,
I have a XML as the datasource. Here is the portion of my
XML
<action1>
<action2>
<action_number>1</action_number>
<action_description>Action
Desc</action_description>
<action_column column_number="1"
column_value="1" />
<action_column column_number="2"
column_value="2" />
<action_column column_number="3"
column_value="3" />
</action2>
<action2>
Here is my Label function for accessing the attributes of the
action_column
public function LabelFunc(item:Object,
column:DataGridColumn): String
return
item.action_column.(@column_number==column.dataField).@column_value;
Now I changed the datagrid column to display the content in
the column in a button using
<mx:DataGridColumn dataField="4"
labelFunction="LabelFuncAction"
itemRenderer="mx.controls.Button"/>
How do I use the click event for the button to toggle b/w yes
and no?

Do you mean it's firing when you click Edit?. I've replicated your code as below and it worked, try to remove the OnRowCommand run a build and then add the it again:
protected void Page_Load(object sender, EventArgs e)
BindGridwithDummy();
protected void GridMainCat_RowCommand(object sender, GridViewCommandEventArgs e)
string catID = e.CommandArgument.ToString();
if (e.CommandName == "Edt" && e.CommandArgument != null)
if (e.CommandName == "Dlt")
private void BindGridwithDummy()
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add(new System.Data.DataColumn("Test", typeof(String)));
dr = dt.NewRow();
dr[0] = "A dummy Data"; //Adds the Dummy Data in the Row
dt.Rows.Add(dr);
// Show the DataTable values in the GridView
GridView1.DataSource = dt;
GridView1.DataBind();
<asp:GridView ID="GridView1" runat="server" OnRowCommand="GridMainCat_RowCommand">
<Columns>
<asp:BoundField DataField="Test" />
<asp:TemplateField>
<HeaderTemplate>
Button</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton Style="padding: 4px;" ID="lnkDel" CommandName="Dlt" runat="server"
CausesValidation="false" Text="Delete" CommandArgument="1" OnClientClick="javascript:return('Are you sure, do you want to delete Record??')"></asp:LinkButton><br />
<asp:LinkButton ID="lnkEdit" runat="server" Text="Edit" CausesValidation="false"
CommandName="Edt" CommandArgument="2" Style="padding: 4px;"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Similar Messages

  • Unable to get CommandAgrument value for the Edit Button in Gridview Control, Mean while it works for the Delete Button

    I want to show Edit/Delete Button using Ajax's HoverMenuExtender Control , But I also want to show edited record using ModalPopup Extender Control of AjaxCotrolltoolkit , for this I have used below code
    <asp:GridView ID="GridMainCat" runat="server" Width="100%" AutoGenerateColumns="false" DataKeyNames="CATID" OnRowDataBound="GridMainCat_RowDataBound" OnRowCommand="GridMainCat_RowCommand" OnPageIndexChanging="GridMainCat_PageIndexChanging" OnSelectedIndexChanging="GridMainCat_SelectedIndexChanging" AllowPaging="true" PageSize="10">
    <Columns>
    <asp:TemplateField>
    <HeaderTemplate>
    <table width="100%" border="1" style="color: blue;">
    <tr>
    <td width="20%">Catg Id</td>
    <td width="20%">Catg Name</td>
    <td width="25%">Catg Desc</td>
    <td width="35%">Catg Image</td>
    <%-- <td width="20%">Created Date</td>--%>
    </tr>
    </table>
    </HeaderTemplate>
    <ItemTemplate>
    <asp:Panel ID="panel2" runat="server">
    <table width="100%">
    <tr>
    <td width="20%"><%#Eval("CATID") %></td>
    <td width="20%"><%#Eval("CATNAME") %></td>
    <td width="25%"><%#Eval("CATDESC") %></td>
    <td width="35%"><%#Eval("CATIMAGE") %></td>
    <%-- <td width="20%"><%#Eval("CREATEDADTE") %></td>--%>
    </tr>
    </table>
    </asp:Panel>
    <!-----Panel for displaying the edit and delete options in GridView------>
    <asp:Panel ID="panel1" CssClass="HoverMenu"
    runat="server" Height="50" Width="50"
    HorizontalAlign="Left">
    <div>
    <asp:LinkButton Style="padding: 4px;" ID="lnkDel"
    CommandName="Dlt" runat="server" CausesValidation="false" Text="Delete" CommandArgument='<%#Bind("CATID") %>' OnClientClick="javascript:return('Are you sure, do you want to delete Record??')">
    </asp:LinkButton><br />
    <asp:LinkButton ID="lnkEdit" runat="server" Text="Edit" CausesValidation="false" CommandName="Edt" CommandArgument='<%#Bind("CATID") %>' style="padding: 4px;" ></asp:LinkButton>
    </div>
    </asp:Panel>
    <asp:HoverMenuExtender ID="HoverMenuExtender1" runat="server" TargetControlID="panel2" PopupControlID="panel1" PopupPosition="Left" HoverCssClass="Hover"></asp:HoverMenuExtender>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    To Show ModalPopup I have used following aspx Code:-
    <asp:Button ID="btnShowPopup" runat="server" Style="display: none" CausesValidation="false" />
    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnShowPopup" PopupControlID="PanelEditMainCategory" CancelControlID="btnUpdate" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
    <asp:Panel ID="PanelEditMainCategory" runat="server" CssClass="modalPopup" Style="display: none;">
    <table style="border-width: 3px; border-color: lightseagreen;" border="1" align="center" height="300px">
    <tr>
    <th>
    <table>
    <tr>
    <th align="left">Category Id:</th>
    </tr>
    <tr>
    <th align="left">Category Name:</th>
    </tr>
    <tr>
    <th align="left">Category Description:</th>
    </tr>
    <tr>
    <th align="left">Category Image:</th>
    </tr>
    </table>
    </th>
    <td>
    <table>
    <tr>
    <td align="left">
    <asp:TextBox ID="txtCatID" Text='<%#Eval("CATID") %>' runat="server" Enabled="false"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td align="left">
    <asp:TextBox ID="txtCatName" Text='<%#Eval("CATNAME") %>' runat="server"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td align="left">
    <asp:TextBox ID="txtCatDesc" runat="server" Text='<%#Eval("CATDESC") %>' TextMode="MultiLine"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td align="left">
    <asp:TextBox ID="txtCatImage" runat="server" Text='<%#Eval("CATIMAGE") %>'></asp:TextBox>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <th align="left" colspan="2">
    <asp:Button ID="btnUpdate" Text="Update" CausesValidation="false" runat="server" OnClick="btnUpdate_Click" />&nbsp;
    <asp:Button ID="btnCancel" Text="Cancel" CausesValidation="false" runat="server" OnClick="btnCancel_Click" />
    </th>
    </tr>
    <tr>
    <th align="left"></th>
    <td align="left"></td>
    </tr>
    </table>
    </asp:Panel>
    Here is my .CS code :-
    protected void GridMainCat_RowCommand(object sender, GridViewCommandEventArgs e)
    catID = e.CommandArgument.ToString();
    if (e.CommandName == "Edt" && e.CommandArgument != null)
    ModalPopupExtender1.Show();
    Bind_Edit_MainCategory(catID);
    if (e.CommandName == "Dlt")
    Bind_Delete_MainCategory(catID);
    private void Bind_Grid_MainCategory()
    using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString))
    using (SqlCommand cmd = new SqlCommand("USP_FETCH_MAINCATEGORY", cn))
    try
    cmd.CommandType = CommandType.StoredProcedure;
    dt = new DataTable();
    da = new SqlDataAdapter(cmd);
    da.Fill(dt);
    GridMainCat.DataSource = dt;
    GridMainCat.DataBind();
    catch (Exception ex)
    throw ex;
    private void Bind_Delete_MainCategory(string catId)
    using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString))
    using (SqlCommand cmd = new SqlCommand("USP_DELETE_MAINCATEGORY", cn))
    try
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@CATID", catId);
    cn.Open();
    cmd.ExecuteNonQuery();
    Bind_Grid_MainCategory();
    catch (Exception ex)
    throw ex;
    private void Bind_Edit_MainCategory(string catid)
    using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString))
    using (SqlCommand cmd = new SqlCommand("USP_EDIT_MAINCATEGORY", cn))
    try
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@CATID", catid);
    cn.Open();
    SqlDataReader dr = cmd.ExecuteReader();
    if (dr.Read())
    txtCatID.Text = dr["CATID"].ToString();
    txtCatName.Text = dr["CATNAME"].ToString();
    txtCatDesc.Text = dr["CATDESC"].ToString();
    txtCatImage.Text = dr["CATIMAGE"].ToString();
    //modalPopupExtender1.Show();
    ModalPopupExtender1.Show();
    Bind_Grid_MainCategory();
    catch (Exception ex)
    throw ex;
    it works fine for HoverMenu Extender, and for the delete button as well. When I click on Delete Button It finds CommandArgument value But as I click on Edit Button It does not find CommandArguement value. Kindly help me to fix this problem

    Do you mean it's firing when you click Edit?. I've replicated your code as below and it worked, try to remove the OnRowCommand run a build and then add the it again:
    protected void Page_Load(object sender, EventArgs e)
    BindGridwithDummy();
    protected void GridMainCat_RowCommand(object sender, GridViewCommandEventArgs e)
    string catID = e.CommandArgument.ToString();
    if (e.CommandName == "Edt" && e.CommandArgument != null)
    if (e.CommandName == "Dlt")
    private void BindGridwithDummy()
    DataTable dt = new DataTable();
    DataRow dr;
    dt.Columns.Add(new System.Data.DataColumn("Test", typeof(String)));
    dr = dt.NewRow();
    dr[0] = "A dummy Data"; //Adds the Dummy Data in the Row
    dt.Rows.Add(dr);
    // Show the DataTable values in the GridView
    GridView1.DataSource = dt;
    GridView1.DataBind();
    <asp:GridView ID="GridView1" runat="server" OnRowCommand="GridMainCat_RowCommand">
    <Columns>
    <asp:BoundField DataField="Test" />
    <asp:TemplateField>
    <HeaderTemplate>
    Button</HeaderTemplate>
    <ItemTemplate>
    <asp:LinkButton Style="padding: 4px;" ID="lnkDel" CommandName="Dlt" runat="server"
    CausesValidation="false" Text="Delete" CommandArgument="1" OnClientClick="javascript:return('Are you sure, do you want to delete Record??')"></asp:LinkButton><br />
    <asp:LinkButton ID="lnkEdit" runat="server" Text="Edit" CausesValidation="false"
    CommandName="Edt" CommandArgument="2" Style="padding: 4px;"></asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>

  • Just downloaded Firefox 4. Running Windows XP. Some of the new features are mising such as the new "Firefox Button" and the new location for the bookmarks button. The look is almost like Firefox 3. Why is this happening?

    Hi. I just downloaded Firefox 4. Some of the new features are missing such as the new "Firefox Button" and the new location for the bookmarks button. It almost looks just like Firefox 3. I am using Windows XP on this desktop computer. On my laptop, running Windows Vista, Firefox 4 has all the updates advertised. Why is this happening? How do I fix?
    Thanks
    Jamie

    Thanks so much!

  • MAC QUESTION--I'm looking for the toggle button for thumbnails

    MAC QUESTION--I'm looking for the toggle button that use to be on the bottom right of desktop folders to increase and decrease the size of the thumbnails.  Does this still exist?

    Glad you got it going. I'm in Thumbnail mode most of the time in my Finder, so I didn't notice that the slider isn't there in others. I'm running Yosemite as well and I'm happy this feature has been kept.
    Thanks for letting me know
    Gene

  • The action for the submit button

    I know that when I insert a Submit button I need to go to the
    property inspector and point to an action file so it can receive
    the data and redirect the visitor to a confirmation page, but I
    have no idea how to make that file. Is there a template for
    something like that?

    quote:
    Should the button be processed in server for redirecting?
    I have added behaviors like Add Java scripts, Pop up Window
    but they are not seen when the submit button is clicked, neither
    would I receive any mail redirected.
    Actually, where would the "action for redirecting" for the
    submit button be processed? Does it depend on CS3 Program or the
    Server?
    Thanks for helping with instuctions.

  • HT4528 I dropped my phone in water, everything works fine except for the home button, it will not work. Any suggestions on how to fix this? I really don't have the money to buy a new phone right now...

    I dropped my phone into water for a split second and everything works fine except for the home button... I really don't have the money for a new iphone right now.. Please tell me some tricks to get it working again... Thank you

    put the phone in an open bowl of rice on a heated surfade such as a raduator
    for 48hours

  • Can somebody decipher the online help for the one button dialog?

    So I was looking at the online help for the one button dialog and there is an extra paragraph compared to the LabVIEW help.
    Clicking on the link goes to a help specific to the Embedded module for the ARM microcontroller. Does this really have much to do with the one button dialog? Does it belong here?
    Just wondering. I am not familiar with that module....
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    OneButtonDialog.png ‏47 KB

    The same is true of the online help back to LV2009 inclusive, which (I believe) would be the first to contain the linked dialog too.
    CLD

  • My iPhone5 says it's eligible for the lock button replacement but I would like to know if having water damage means they won't repair it. Does anyone know?

    My iPhone5 says it's eligible for the lock button replacement but I would like to know if having water damage means they won't repair it. Does anyone know?

    Probably not covered but only Apple can tell you after they look at it.

  • How much for the power button replacement?

    Power button for my iphone 5 can't work,can't power on/off or wake/sleep the device,have to plug in PC for power on, the apple warranty service for my iphone has expired,so, how much for the power button replacement?

    Out of warranty replacement thru apple is $269.00 USD.  That includes a 90 day warranty on the replacement device.  You might want to check for repair shops that will just repair the power button, but since your warranty is expired, that might be a cheaper option for you.
    HTH

  • How can I edit the default settings for the Email button?

    I saw this question posted for February and as yet still unanswered. So I am now asking it again.
    I do not want to use my .mac account email address in my website. I want it linked to my domain. I have found no specific instructions for changing the default. Also my drag down "Link to" menu in the Inspector does not work.
    Thanks........
    eMac   Mac OS X (10.3.9)  
    eMac   Mac OS X (10.3.9)  

    While you can't edit the default email address in iWeb, there is a workaround which may suit.
    In Safari, locate a web page which has iWeb's email button on it (if you've already published a site, one of your own web pages is ideal). Control-click on the button and select 'Add Image to iPhoto Library'. Drag this image from the Media Browser to your iWeb page, select the image, and use the Link inspector to enable it as a hyperlink linking to 'An Email Message'. Enter whatever email address you like in the To box and a Subject for the message if you wish.
    To make things easier, create an iWeb library in iPhoto and add the email button to it for handy access.
    [ Visit here for iWeb Tips, Tricks and Hacks ]

  • How can I get the light for the power button to go back on?

    I would like to get the power button light to work properly again. I have a p6813W desktop running Windows 7, 64 bit OS.
    The first time the machine went into sleep mode and was awoken the power button light went out and has not yet to come back on even after many shutdowns and restarts. I can't easity tell if my computer is on or off. How can I get the light to work properly again?
    Thanks.

    Mac's don't have UI scale options like Windows has.
    Either you can drop the screen resolution in Displays a wee bit and make things appear distorted, or do what I do and use the Universal Access and set a control key, then use a mouse wheel/scroll to zoom in and out where the mouse is pointed.
    For easier web surfing I've got a good solution here
    Better surfing options for hard of seeing users

  • No timellines for the first Interaction (when I use 2 for the same button)

    I have 3 pages and one button (on page 1) that have (a) an OnClick "Play transition to page2" AND (same button) (b) an OnClick "Play transition to page3"...
    The first transition (transition to page2) seems to play without any regards to the length (seconds) of the timelines that I set... it seems to do whatever it suppose to do but in a fraction of a second (like if I had set the timelines to 0 sec.). After, the second transition (transition to page 3) works fine (according to the number of seconds that I set in the timelines.
    Is it a bug or a misunderstanding on my part?
    Thanks

    Thanks for posting your project, Roger.
    What's happening here is this:
    You have two interactions on the button: On Click > Play Transition to Page2, and On Click > Play Transition to Page3. You expected it to play Page1 > Page2, and THEN play Page2 > Page3, which is understandale, because that's sure as heck what the interactions panel LOOKS like it's going to do. Right?
    Well, unfortunately, it doesn't work that way. Whenever you trigger a "Play Transition to State" interaction, it happens immediately, cancelling the current transition and starting the new one. So Catalyst is starting the transition Page1 > Page2, and then immediately interrupting it with Page2 > Page3.
    You can corroborate my explanation by trying this: add another button with the interaction: On click > play transition to Page1 > Page2. When you click that button, the transition plays incorrectly.
    I think there is a conceptual mismatch here. It seems that you're trying to use states like keyframes. In this case, Page2 is just an intermediate keyframe, and Page3 is the actual destination. Right? However, states are not keyframes. They are the various destinations, or endpoints, of your application. E.g. If your website has a "Home" and a "Products" page, those would be your states, regardless of how you choose to animate between them.
    So, then, how do you do more elaborate, keyframe-like animations? There are basically two answers to this question:
    A) FC's animation tools are for the simple transitions that typically happen in web applications. If you want sophisticated animation, you can use Flash Professional, which can create beautiful, incredibly complex animations. Flash Catalyst and Flash Professional are not tightly integrated at this point (you can embed a SWF created in either product in a project created in the other), so you'll need to make a judgment call for your particular project.
    B) You can do somewhat more complex animations in FC by adding additional actions, other than the default ones, to your timelines. Here's a simplified example that will illustrate the technique:
    1.  Create a new project
    2.  Drag out a button from the Wireframe Components panel
    3.  Duplicate state
    4.  In Page2, move the button somewhere else
    5.  Look at the Page1 > Page2 transition. You should see a 0-length "Move". Click "Smooth Transition" to make this take some time. Preview the transition. You should see a simple linear move. Select the move effect and Look in the properties panel. Notice the combo box that says "State Transition". Don't change it.
    6.  With the button selected, in the Timelines panel, click "Add Action > Move". Select this move effect and look in the properties panel. Notice the combo box says "Relative", with X and Y beneath it.
    7.  Drag the original move effect so that it happens AFTER the relative move. Preview the transition. You should see the button move to the relative position (by default, X and Y increase by 100px each), and THEN move back to the Page2 position.
    8.  By changing X and Y of the relative move, you can get the button to go anywhere.
    9.  Let me know if it works!
    One caveat to this technique: make sure your moves are arranged down and to the right in the timelines panel. There is a bug that if you have two moves adjacent, and they are arranged up and to the left, they won't work correctly.
    -Adam

  • Where is the code for the collapse button in the default SAP iview layout?

    I need to eliminate the collapse/restore button displayed on each iView tray. I was looking at the default layout component (com.sap.portal.layouts.default) but I could not find the code for the tray.  The code for "FullWidth.jsp" (this file that implements the "FullWidth" component) is below:
    <%@ taglib uri="prt:taglib:com.sap.portal.reserved.layout.TagLibHtmlb" prefix="hbj" %>
    <%@ taglib uri="prt:taglib:com.sap.portal.reserved.layout.TagLibLayout" prefix="lyt" %>
    <lyt:template>
        <hbj:content id="myContext" >
            <hbj:page title="Portal Page">
                <lyt:container id="column1"  />
            </hbj:page>
        </hbj:content>
    </lyt:template>
    as you can see, there is no reference to the tray tags.
    note: I am familiar with how to create a new iView tray using the new Layout Tag Library (from blog below)
    EFP: Layout Tag Library
    , but I want am not interested in this approach... All I want is to modify the EXISTING tray.

    Hi,
    may be it's helpful for you.
    http://blog.flexexamples.com/2010/05/18/changing-the-background-color-of-a-disabled-spark- textarea-control-in-flex-4/
    Regards
    -Bechar

  • GPO for the "sign" button in outlook 2010.

    Hi.
    I'm facing a issue where i'm trying ti figure out why moving users between 2 OU's will grey out the Sign button in outlook.
    There is a valid signature and all i need to do is just move the OU and it works. 
    So my questions is which policy / registry setting can control this? I know it probably can be more but i am hoping someone experienced the same and can point me somewhere. Been trying for days now myself and just cant work out which policy it is. 

    Hi,
    Would you please specify what "Sign" button in Outlook 2010? We'll appreciate it if you can provide a screenshot to help us understand the issue. You can share the screenshot regarding this issue to us by sending it to
    GBSD TN Office Information Collection  [email protected] (The email subject should be the thread link)
    Thanks,
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Is it possible to specify a starting FILE for the browse button dialog?

    I realize I can specify a starting directory/folder PATH for the dialog window that opens when the Browse Button for a file path control is clicked. 
    Is there also a way to programatically preset the "File Name" field in the window that pops up?    (for LV v7.1.1)

    You could use a normal path control (without browse button), a browse button boolean control, openg has one. And use a value change event (in that way you can force user to use the dialog). In the event case you can use a browse function where you can set a filename.
    Ton
    Edit: I am not totally sure for 7.1...
    Message Edited by TonP on 12-15-2006 05:30 PM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

Maybe you are looking for

  • How can I use multiple icloud Accounts with Fotos?

    Hello. Yesterday, my wife and I started using the new App "Fotos" on OSX and iOS. What I can't figure out, and where I would like to get some insight and help, is how we should use our icloud Accounts. How it is right now: - Wife (MacBook and iPhone)

  • Sync folders in home folder

    I have AD-OD home folders set up fine. I have a small problem however. When I make another folder in the Users home folder, ie Downloads or whatever, that won't sync because of permission issues. Folders created on the desktop works fine. Any ideas?

  • CRM BADI CRM_COND_COM_BADI only called when line created or changed

    I am trying to ensure that the BADI CRM_COND_COM_BADI is called (to adjust pricing communication structure) for all line items every time a user hits update or enter during creation of a sales order via the web.  In my testing I am finding that the B

  • Can't find the way to prevent pop ups

    Can't get to the options tab to control pop ups. Advertising messages etc just keep appearing unsolicited.

  • Not Allowing Goods Movements for the confirmed quantity in the delivery

    Hi Gurus, I would like know how to make the system not allowing movement for a batch at MB11  when that batch of one material is confirmed in a delivery?  ex: In the delivery: material number: 9009, Batch  0000A and quantity is 10. And there is no mo