Click here to Skip to main content
15,900,818 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: inserting data to SQL via Storeprocedure(Please help) Pin
JHizzle28-Jun-10 4:39
JHizzle28-Jun-10 4:39 
GeneralRe: inserting data to SQL via Storeprocedure(Please help) Pin
future383928-Jun-10 15:48
future383928-Jun-10 15:48 
GeneralRe: inserting data to SQL via Storeprocedure(Please help) Pin
JHizzle28-Jun-10 21:14
JHizzle28-Jun-10 21:14 
GeneralRe: inserting data to SQL via Storeprocedure(Please help) Pin
future383929-Jun-10 14:41
future383929-Jun-10 14:41 
GeneralRe: inserting data to SQL via Storeprocedure(Please help) Pin
JHizzle29-Jun-10 22:19
JHizzle29-Jun-10 22:19 
GeneralRe: inserting data to SQL via Storeprocedure(Please help) Pin
future383930-Jun-10 5:26
future383930-Jun-10 5:26 
GeneralRe: inserting data to SQL via Storeprocedure(Please help) Pin
JHizzle30-Jun-10 6:17
JHizzle30-Jun-10 6:17 
QuestionProblem getting EditCommand event to fire in nested DataGrid Pin
Phillip Donegan28-Jun-10 2:39
Phillip Donegan28-Jun-10 2:39 
Hi All,

I have a details view which contains a datagrid. They are both populating fine but now I want to edit the rows in the datagrid.

I'm setting up the datagrid like so:

protected override void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            DataGrid productCulturesDataGrid = ((DataGrid)ProductDetailsView.FindControl("ProductsCultureDataGrid"));

            productCulturesDataGrid.EditCommand += new DataGridCommandEventHandler(this.ProductsCultureDataGrid_EditCommand);
            this.Load += new System.EventHandler(this.Page_Load);
        }


And then in the page load method i'm setting the datasource like so:
//GetListOfProductCultures
                        List<ProductsCultureInfo> productCultures = (List<ProductsCultureInfo>)ListOfProductCultures();

 DataGrid productCulturesDataGrid = ((DataGrid)ProductDetailsView.FindControl("ProductsCultureDataGrid"));
                        productCulturesDataGrid.DataSource = productCultures;
                        productCulturesDataGrid.DataBind();


The EditCommand method looks like this but is never triggered:

private void ProductsCultureDataGrid_EditCommand(object sender, DataGridCommandEventArgs e)
{
    DataGrid ProductsCultureDataGrod = (DataGrid)ProductDetailsView.FindControl("ProductsCultureDataGrid");
    ProductsCultureDataGrod.EditItemIndex = e.Item.ItemIndex;
}


Any ideas what i'm doing wrong? Also not sure if this has anything to do with it but this is a dotnetnuke module.

Thanks
Phil

P.S. here is the ascx page encase that helps

<asp:DetailsView ID="ProductDetailsView" runat="server" Height="50px" Width="125px" EnableModelValidation="True" AutoGenerateRows="False">
    <Fields>
        <asp:BoundField DataField="ProductID" HeaderText="Product ID" Visible="False" />
        <asp:TemplateField HeaderText="Name">
            <ItemTemplate>
                <asp:Label ID="NameLabel" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Description">
            <ItemTemplate>
                <asp:Label ID="DescriptionLabel" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Thumbnail">
            <ItemTemplate>
                <asp:TextBox ID="ThumbnailTextBox" runat="server" Text='<%# Bind("ThumbURL") %>' />
                <asp:Image ID="ThumbnailImage" runat="server" ImageUrl='<%# Bind("ThumbURL") %>' />
                <asp:LinkButton ID="cmdUpdateThumbnail" runat="server" BorderStyle="None" Text="Test URL" OnClick="cmdUpdateThumbnail_Click" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Ext Product ID">
            <ItemTemplate>
                <asp:TextBox ID="ExtProductIDTextBox" runat="server" Text='<%# Bind("ExtProductID") %>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Builder Type">
            <ItemTemplate>
                <asp:DropDownList ID="BuilderTypesDropDownList" runat="server">
                    <asp:ListItem>Calendars</asp:ListItem>
                    <asp:ListItem>Cards and Stationery</asp:ListItem>
                    <asp:ListItem>Gifts</asp:ListItem>
                    <asp:ListItem>Photobooks</asp:ListItem>
                </asp:DropDownList>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Active">
            <ItemTemplate>
                <asp:CheckBox ID="ActiveCheckBox" runat="server" Checked='<%# Bind("Active")%>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Culture Variations">
            <ItemTemplate>
                <asp:DataGrid ID="ProductsCultureDataGrid" runat="server" AutoGenerateColumns="false">
                    <Columns>
                        <asp:BoundColumn DataField="ItemID" HeaderText="ProductCultureID" Visible="False">
                        </asp:BoundColumn>
                        <asp:BoundColumn DataField="CultureCode" HeaderText="Culture Code"></asp:BoundColumn>
                        <asp:BoundColumn DataField="Name" HeaderText="Name"></asp:BoundColumn>
                        <asp:BoundColumn DataField="Description" HeaderText="Description"></asp:BoundColumn>
                        <asp:BoundColumn DataField="Currency" HeaderText="Currency"></asp:BoundColumn>
                        <asp:BoundColumn DataField="CurrencySymbol" HeaderText="Currency Symbol"></asp:BoundColumn>
                        <asp:BoundColumn DataField="Price" HeaderText="Price"></asp:BoundColumn>
                        <asp:TemplateColumn HeaderText="Symbol At Front?">
                            <ItemTemplate>
                                <asp:CheckBox ID="SymbolAtFront" runat="server" Checked='<%# Bind("SymbolAtFront") %>' />
                            </ItemTemplate>
                        </asp:TemplateColumn>
                        <asp:EditCommandColumn EditText="Edit" ButtonType="PushButton"></asp:EditCommandColumn>
                    </Columns>
                </asp:DataGrid>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Button ID="AddNewCultureButton" runat="server" Text="Add Culture Variation" OnClick="AddNewCultureButton_Click" />
            </ItemTemplate>
        </asp:TemplateField>
    </Fields>
</asp:DetailsView>

AnswerRe: Problem getting EditCommand event to fire in nested DataGrid Pin
Phillip Donegan29-Jun-10 3:17
Phillip Donegan29-Jun-10 3:17 
QuestionJavascript Method call!! Pin
sabby200628-Jun-10 0:31
sabby200628-Jun-10 0:31 
AnswerRe: Javascript Method call!! Pin
Sandeep Mewara28-Jun-10 0:47
mveSandeep Mewara28-Jun-10 0:47 
AnswerRe: Javascript Method call!! Pin
Venkatesh Mookkan28-Jun-10 1:26
Venkatesh Mookkan28-Jun-10 1:26 
AnswerRe: Javascript Method call!! Pin
Not Active28-Jun-10 2:52
mentorNot Active28-Jun-10 2:52 
QuestionTextBox Readonly Property Pin
Anurag Gandhi27-Jun-10 22:36
professionalAnurag Gandhi27-Jun-10 22:36 
AnswerRe: TextBox Readonly Property Pin
JHizzle27-Jun-10 23:39
JHizzle27-Jun-10 23:39 
AnswerRe: TextBox Readonly Property Pin
Brij27-Jun-10 23:48
mentorBrij27-Jun-10 23:48 
GeneralRe: TextBox Readonly Property Pin
Anurag Gandhi28-Jun-10 0:44
professionalAnurag Gandhi28-Jun-10 0:44 
GeneralRe: TextBox Readonly Property Pin
Brij28-Jun-10 4:45
mentorBrij28-Jun-10 4:45 
GeneralRe: TextBox Readonly Property Pin
Anurag Gandhi28-Jun-10 20:41
professionalAnurag Gandhi28-Jun-10 20:41 
AnswerRe: TextBox Readonly Property Pin
Sandeep Mewara28-Jun-10 0:46
mveSandeep Mewara28-Jun-10 0:46 
GeneralRe: TextBox Readonly Property Pin
Anurag Gandhi28-Jun-10 1:59
professionalAnurag Gandhi28-Jun-10 1:59 
GeneralRe: TextBox Readonly Property Pin
Sandeep Mewara28-Jun-10 2:02
mveSandeep Mewara28-Jun-10 2:02 
GeneralRe: TextBox Readonly Property Pin
Phillip Donegan28-Jun-10 5:02
Phillip Donegan28-Jun-10 5:02 
GeneralRe: TextBox Readonly Property Pin
Sandeep Mewara28-Jun-10 5:05
mveSandeep Mewara28-Jun-10 5:05 
AnswerRe: TextBox Readonly Property Pin
T M Gray28-Jun-10 7:17
T M Gray28-Jun-10 7:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.