Archive for » January, 2009 «

Friday, January 30th, 2009 | Author: admin

The aspx page

<asp:TemplateField>
   <ItemTemplate>
     <asp:LinkButton ID="btnTemplate" runat="server" OnClick="btnTemplate_Click">LinkButton</asp:LinkButton>
   </ItemTemplate>
</asp:TemplateField>

 

 

The C# code behind

protected void btnTemplate_Click(object sender, EventArgs e)
   {
       //Clear Selection
       GridView1.SelectedIndex = -1;

       // Get the checkbox that was Selected
       LinkButton btnTemplate = (LinkButton)sender;

       // As this is a template column, we can get the specifc row by using the Naming Container
       GridViewRow selectedGridRow = (GridViewRow)btnTemplate.NamingContainer;

       // get the userID from the first column that is hidden by CSS
       Response.Write(selectedGridRow.Cells[0].Text);
   }

Category: ASP.NET, C#  | Leave a Comment
Tuesday, January 13th, 2009 | Author: admin
ddEvents.Items.Insert(0, (new ListItem("Select Event...", "0")));

Category: ASP.NET, C#  | Leave a Comment
Friday, January 02nd, 2009 | Author: admin
//set the drop down list values
            if (ddAccounts.Items.FindByValue(cb.parentAccountID.ToString()) != null)
            {
                ddAccounts.Items.FindByValue(cb.parentAccountID.ToString()).Selected = true;
            }
Category: ASP.NET, C#  | Leave a Comment