Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsLanguage PacksLanguage Packsan editable datagrid not working with localizationan editable datagrid not working with localization
Previous
 
Next
New Post
3/11/2006 11:42 PM
 

<asp:datagrid id="dgContactHistory" runat="server" BorderColor="#999999"

BorderWidth="1px" EnableViewState="True" ShowHeader="True" ShowFooter="True"          AutoGenerateColumns="False" AllowSorting="True" OnEditCommand="dgContactHistory_EditCommand" OnCancelCommand="dgContactHistory_CancelCommand"

OnDeleteCommand="dgContactHistory_DeleteCommand"

OnItemCommand="AddContactHistory"

OnUpdateCommand="dgContactHistory_UpdateCommand"

DataKeyField="ContactHistoryID">

<Columns>

<asp:TemplateColumn HeaderText="ContactDate" ItemStyle-HorizontalAlign="Center">

   <ItemTemplate>

        <asp:Label id="lblContactDate" runat="server">

            <%# String.Format("{0:dd/MM/yy}",DataBinder.Eval(Container.DataItem, "ContactDate")) %> </asp:Label>

   </ItemTemplate>

   <FooterTemplate>

       <asp:TextBox id="txtContactDate" runat="server" Columns="6" />

   </FooterTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="TrustRep" >

    <ItemTemplate>

       <asp:Label id="lblTrustRep" runat="server">

       <%# DataBinder.Eval(Container.DataItem, "TrustRepID") %>

       </asp:Label>

    </ItemTemplate>

 <FooterTemplate>

      <asp:dropdownlist id="cboTrustReps" autopostback="false" datavaluefield="Value" datatextfield="Text" runat="server" Width="80px"></asp:dropdownlist>

 </FooterTemplate>

</asp:TemplateColumn>

 <asp:TemplateColumn HeaderText="Campaign">

      <ItemTemplate>

        <asp:Label id="lblCampaign" runat="server">

           <%# DataBinder.Eval(Container.DataItem, "PhoneOpID") %>

        </asp:Label>

      </ItemTemplate>

  <FooterTemplate>

      <asp:dropdownlist id="cboCampaigns" autopostback="false" datavaluefield="Value" datatextfield="Text" runat="server" Width="140px"></asp:dropdownlist>

  </FooterTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="ContactType" >

   <ItemTemplate>

      <asp:Label id="lblContactType" runat="server">

           <%# DataBinder.Eval(Container.DataItem, "ContactTypeID") %>

      </asp:Label>

   </ItemTemplate>

  <FooterTemplate>

     <asp:dropdownlist id="cboContactTypes" autopostback="false" datavaluefield="Value" datatextfield="Text" runat="server" Width="80px"/>              </FooterTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="ConversationDetails">

     <ItemTemplate>

          <asp:Label id="lblContactHistory" runat="server">

           <%# DataBinder.Eval(Container.DataItem, "ConversationDetails") %>

          </asp:Label>

      </ItemTemplate>

   <FooterTemplate>

     <asp:TextBox id="txtAddConversationDetails" runat="server" TextMode="MultiLine" Columns="45" />

  </FooterTemplate>

<EditItemTemplate>

<asp:TextBox Columns="45" id="txtEditContactHistory" runat="server"  TextMode="MultiLine" Text='<%# DataBinder.Eval(Container.DataItem, "ConversationDetails") %>'>

  </asp:TextBox>

</EditItemTemplate>

</asp:TemplateColumn>

 <asp:TemplateColumn HeaderText="Removal" FooterStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">

    <ItemTemplate>

     <asp:CheckBox id="chkRequestedRemoval" runat="server" Checked=<%# DataBinder.Eval(Container.DataItem, "RequestedRemoval") %>></asp:CheckBox>

  </ItemTemplate>

  <FooterTemplate>

     <asp:CheckBox runat="server" id="chkAddRequestedRemoval"/>

   </FooterTemplate>

  </asp:TemplateColumn>

 

 <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit" >

</asp:EditCommandColumn>

  <asp:TemplateColumn>

    <ItemTemplate>

       <asp:LinkButton runat="Server" Text="Delete" resourcekey="cmdDelete" CommandName="Delete" ID="Linkbutton2" />

    </ItemTemplate>

  <FooterTemplate>

    <asp:LinkButton Text="Add" Runat="Server" resourcekey="cmdAdd" CommandName="doAdd" ID="Linkbutton1" />

  </FooterTemplate>

  </asp:TemplateColumn>

                             

  </Columns>

</asp:datagrid>

 

Hi,

I have created an editable datagrid, which allows me to edit and delete using the asp:EditCommandColumn control. I have also inserted an Add functiontionality which sits in the footer at the bottom of each corresponding column (two text boxes, 3 dropdownlists, and an Add linkbutton) and everything works perfectly... except for 2 localization problems:

1. The column headers are not localized (I am using HeaderText="myColumn" in the ascx and myColumn.Header in the Rex file, which works well for me in other simple datagrids I have). I have tried to take out the asp:EditCommandColumn to see if it solves the problem but it didnt. My guess is that it might have something to do with having 3 types of templates (ItemTemplate, FooterTemplate and EditItemTempalte) within one asp:TemplateColumn, but I might be wrong.

2. I can't work out how to localize the "Edit", "Cancel" and "Update" buttons of the asp:EditCommandColumn. I have tried to put in a resourcekey="buttonName" as a property of the asp:EditCommandColumn, but it crashes with a complaint that resourcekey is not a known property. The other link buttons (Add and Delete) are localized ok with resourcekey.

Would appreciate help. I am enclosing the datagrid code:

 
New Post
3/13/2006 3:32 AM
 
1. To localize datagrid headers you have to call Localization.LocalizeDataGrid before binding the data.
See Documents module for an example of use

2. You'll have to convert these to template columns and the use the same approach as in the Add and delete buttons you alredy have.

Vicenç Masanas
Banyoles, Girona - Spain

Disgrafic.com    PSD to DNN
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsLanguage PacksLanguage Packsan editable datagrid not working with localizationan editable datagrid not working with localization


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out