locked
Gridview selectedvalue error RRS feed

  • Question

  • User1811156929 posted

    Hi Friends,
    Actually i tried to set selected value of Gridview (Inline Code) if the list items are int(1,2,..) it is working but if i use char(A,B,..) it through error like "invalid because it does not exist in the list of items".

    <asp:TemplateField HeaderText="SinterLottype" SortExpression="SinterLottype">
    <EditItemTemplate>
    <asp:DropDownList ID="ddSntrLTtyp" runat="server" SelectedValue ='<%# Bind("SinterLottype") %>' >
    <asp:ListItem>A</asp:ListItem>
    <asp:ListItem>B</asp:ListItem>

    </asp:DropDownList>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label ID="lblSntrtyp" runat="server" Text='<%# Bind("SinterLottype") %>'></asp:Label>
    </ItemTemplate>
    </asp:TemplateField>

    In the selectedvalue code any conversion required? Pls suggest

    Friday, September 21, 2018 3:55 AM

Answers

  • User1811156929 posted

    Hi After loosing some hair i found data specification mismatch in sql and inline code. i made same data specification like char everywhere, it solved the problem. The error it throws is misguiding us.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 21, 2018 6:14 AM