updatepanel datagrid and dropdownlist

Last post 07-23-2007 12:10 AM by chetan.sarode. 4 replies.

Sort Posts:

  • updatepanel datagrid and dropdownlist

    07-19-2007, 8:54 PM
    • Member
      point Member
    • dygytalnomad
    • Member since 07-20-2007, 12:38 AM
    • Posts 2

    I have an updatepanel which holds a datagrid and inside the datagrid are 3 dropdownlist.  I have a button that queries a database to populate the datagrid with what the user selects. The page populates the first 2 dropdownlist in the grid, but not the third???  I don't know what I'm doing wrong.  Here's code snippet

     

                                        <tr class=tableRow>
                                            <td colspan=2 style="height: 205px;" class=tableRow valign=top width = 100%>
                                                <asp:UpdateProgress id="UpdateProgress1" runat="server" DisplayAfter="10"><ProgressTemplate>
                                                &nbsp;&nbsp;<IMG src="images/green_rot.gif" /> Loading.......... <IMG src="images/green_rot.gif" />
                                                </ProgressTemplate>
                                                </asp:UpdateProgress>                                       
                                                <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                                <Triggers>
                                                    <asp:AsyncPostBackTrigger ControlID="btnStart" />
                                                </Triggers>
                                                    <ContentTemplate>
                                                    <asp:Label ID="lblDates" runat="server" Width="448px" /><br /><br />
                                                <asp:DataGrid runat=server ID="dg"
                                                    AutoGenerateColumns=False
                                                    ShowFooter=True                                                
                                                    OnEditCommand = "dg_EditCommand"
                                                    OnCancelCommand = "dg_CancelCommand"                                               
                                                    OnUpdateCommand = "dg_UpdateCommand"
                                                    OnItemCommand="processGrid"
                                                    DataKeyField="TSID" Font-Bold="False" BorderColor="Black" BorderWidth="1px" GridLines="Horizontal" Width="100%" class=tableRow
                                                    >
                                                    <Columns>
                                                        <asp:TemplateColumn HeaderText="Job">
                                                            <ItemTemplate>
                                                                <%#Container.DataItem("Job")%>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <asp:DropDownList ID="ddlEditNumber" runat=server DataTextField="Description", DataValueField="ProjectID" Width=250/>
                                                                <asp:LinkButton ID="btnEditSearch" runat=server Text="<img  border=0 src=images/refresh.jpg alt='Job' width=16>" CommandName="EditJob" />
                                                            </EditItemTemplate>
                                                            <FooterTemplate>                                                           
                                                                <asp:DropDownList ID="ddlJob" runat=server  DataTextField="Description" DataValueField="Job" Width=250/>
                                                                <cc1:ListSearchExtender ID="lseJob" runat="server" PromptPosition=bottom TargetControlID="ddlJobNumber"/>
                                                                <asp:LinkButton ID="btnJobSearch" runat=server Text="<img  border=0 src=images/refresh.jpg alt='Job' width=16>" CommandName="Job" />
                                                            </FooterTemplate>                               
                                                        </asp:TemplateColumn>
                                                        <asp:TemplateColumn HeaderText="Codes">
                                                            <ItemTemplate>
                                                                <%#Container.DataItem("CODE")%>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <asp:DropDownList ID="ddlEditCodes" runat=server DataTextField="CodeDescription", DataValueField="Code" Width=300/>
                                                                <cc1:ListSearchExtender ID="lseEditCodes" runat="server" PromptPosition=bottom TargetControlID="ddlEditCodes"/>
                                                            </EditItemTemplate>
                                                            <FooterTemplate>
                                                                <asp:DropDownList ID="ddlCodes" runat=server  DataTextField="CodeDescription" DataValueField="Code" Width=300/>
                                                                <cc1:ListSearchExtender ID="lseCodes" runat="server" PromptPosition=bottom TargetControlID="ddlCodes"/>
                                                            </FooterTemplate>                               
                                                        </asp:TemplateColumn>
                                                        <asp:TemplateColumn HeaderText="Pay">
                                                            <ItemTemplate>
                                                                <%#Container.DataItem("PAY")%>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <asp:DropDownList ID="ddlEditPay" runat=server DataTextField="Description", DataValueField="Pay" Width=50 />
                                                            </EditItemTemplate>
                                                            <FooterTemplate>
                                                                <asp:DropDownList ID="ddlPay" runat=server DataTextField="Description" DataValueField="Pay" Width=50 />
                                                            </FooterTemplate>                               
                                                        </asp:TemplateColumn>
                                                        <asp:TemplateColumn HeaderText="Hours">
                                                            <ItemTemplate>
                                                                <%#Container.DataItem("HOURS")%>
                                                            </ItemTemplate>
                                                            <EditItemTemplate>
                                                                <asp:TextBox ID="txtEditHours" runat="server" Text='<%# Container.DataItem("HOURS")%>'/>
                                                            </EditItemTemplate>
                                                            <FooterTemplate>
                                                                <asp:TextBox ID="txtHours" runat="server" width=50/>
                                                            </FooterTemplate>
                                                        </asp:TemplateColumn>
                                                        <asp:TemplateColumn HeaderText="Actions">
                                                            <ItemTemplate>
                                                                <asp:LinkButton ID="lbnDelete" runat=server Text="<img border=0 src=images/im_delete.gif alt=delete>" CommandName="Delete" CausesValidation=false />
                                                                <asp:LinkButton ID="lbnEdit" runat=server Text="<img border=0 src=images/im_edit.gif alt=edit>" CommandName = "Edit" CausesValidation=false />
                                                            </ItemTemplate>                                                       
                                                            <EditItemTemplate>
                                                                <asp:LinkButton ID="lbnCancel" runat=server Text="<img border=0 src=images/im_cancel.gif alt=cancel>" CommandName = "Cancel" CausesValidation=false />
                                                                <asp:LinkButton ID="lbnUpdate" runat=server Text="<img border=0 src=images/im_update.gif alt=update>" CommandName = "Update" CausesValidation=false />
                                                            </EditItemTemplate>
                                                            <FooterTemplate>
                                                                <asp:Linkbutton runat=server ID="lbnAddRecord" Text="<img  border=0 src=images/im_update.gif alt=save>" CommandName="addRecord"></asp:Linkbutton>                                                           
                                                            </FooterTemplate>               
                                                        </asp:TemplateColumn>
                                                    </Columns>
                                                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                                                    <AlternatingItemStyle BackColor="Khaki" Font-Bold="False" Font-Italic="False" Font-Overline="False"
                                                        Font-Strikeout="False" Font-Underline="False" />
                                                </asp:DataGrid><br />

    What is called on the async call back?

  • Re: updatepanel datagrid and dropdownlist

    07-19-2007, 11:48 PM

    You have written

     <EditItemTemplate>
           <asp:DropDownList ID="ddlEditCodes" runat=server DataTextField="CodeDescription", DataValueField="Code" Width=300/>

    Why you gave comma (,) after DataTextField="CodeDescription". Remove that comma & check if it works.

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: updatepanel datagrid and dropdownlist

    07-20-2007, 11:18 AM
    • Member
      point Member
    • dygytalnomad
    • Member since 07-20-2007, 12:38 AM
    • Posts 2

     I took out the (,) and that didn't fix anything???

  • Re: updatepanel datagrid and dropdownlist

    07-22-2007, 2:01 AM
    • Member
      50 point Member
    • jaws1021
    • Member since 05-16-2007, 3:37 PM
    • Posts 189

    I have very similiar thing, mine, I have dropdowns flickers inside the datagrid because of ajax bug I found out, not good with browser IE 6, it is no problem on firefox..Is yours flickers too inside the datagrid?

  • Re: updatepanel datagrid and dropdownlist

    07-23-2007, 12:10 AM

    I will run you code in my m/c lets see..

    I will let you know..Try to debug your code & see whats happening with 3rd dropdownlist.

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
Page 1 of 1 (5 items)