edit datagrid with dropdownlist

Discussion in 'ASP .Net' started by Mike P, Aug 21, 2003.

  1. Mike P

    Mike P Guest

    I have a template column with a drop down list which should pass the
    value selected by the user to a function which will return a value of
    its place in the list...I keep getting the error 'denotes a 'property'
    where a 'method' was expected'. Any ideas?

    <asp:TemplateColumn HeaderText="CallType">
    <ItemTemplate>
    <%# DataBinder.Eval(Container.DataItem, "CallType") %>
    </ItemTemplate>

    <EditItemTemplate>
    <asp:DropDownList runat="server" id="lstCallTypes"
    DataValueField="CallType"
    DataTextField="CallType"
    DataSource='<%# GetCallTypes() %>'
    SelectedIndex='<%#
    GetSelIndex(Container.DataItem("CallType")) %>'
    />
    </EditItemTemplate>

    </asp:TemplateColumn>


    private int GetSelIndex(string strCallType)
    {
    int intLoop;
    //Loop through each row in the DataSet
    DataTable dt = ddlDataSet.Tables["CallTypes"];

    for (intLoop = 0; intLoop >= dt.Rows.Count-1; intLoop ++)
    {
    if (Int32.Parse(strCallType) =
    Int32.Parse((string)dt.Rows[intLoop]["CallType"]))
    {
    return intLoop;
    }
    }
    }

    Thanks,

    Mike



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mike P, Aug 21, 2003
    #1
    1. Advertising

  2. Hi

    Please look into the following URL:
    http://www.4guysfromrolla.com/webtech/050801-1.shtml

    Ravikanth[MVP]


    >-----Original Message-----
    >I have a template column with a drop down list which

    should pass the
    >value selected by the user to a function which will

    return a value of
    >its place in the list...I keep getting the

    error 'denotes a 'property'
    >where a 'method' was expected'. Any ideas?
    >
    ><asp:TemplateColumn HeaderText="CallType">
    >

    <ItemTemplate>
    >

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

    </ItemTemplate>
    >


    >

    <EditItemTemplate>
    >

    <asp:DropDownList
    runat="server" id="lstCallTypes"
    >

    DataValueField="CallType"
    >

    DataTextField="CallType"
    >

    DataSource='<%# GetCallTypes() %>'
    >

    SelectedIndex='<%#
    >GetSelIndex(Container.DataItem("CallType")) %>'
    >

    />
    >

    </EditItemTemplate>
    >


    >

    </asp:TemplateColumn>
    >
    >
    >private int GetSelIndex(string strCallType)
    >{
    > int intLoop;
    > //Loop through each row in the DataSet
    > DataTable dt = ddlDataSet.Tables["CallTypes"];
    >
    > for (intLoop = 0; intLoop >= dt.Rows.Count-1; intLoop

    ++)
    > {
    > if (Int32.Parse(strCallType) =
    >Int32.Parse((string)dt.Rows[intLoop]["CallType"]))
    > {
    > return intLoop;
    > }
    > }
    >}
    >
    >Thanks,
    >
    >Mike
    >
    >
    >
    >*** Sent via Developersdex http://www.developersdex.com

    ***
    >Don't just participate in USENET...get rewarded for it!
    >.
    >
     
    Ravikanth[MVP], Aug 21, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. San Diego Guy
    Replies:
    0
    Views:
    551
    San Diego Guy
    Aug 7, 2003
  2. Schultz
    Replies:
    3
    Views:
    568
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Feb 14, 2005
  3. Andreas Klemt
    Replies:
    0
    Views:
    310
    Andreas Klemt
    Oct 8, 2003
  4. Sharon McCarty
    Replies:
    0
    Views:
    253
    Sharon McCarty
    Nov 24, 2004
  5. Frank Kurka
    Replies:
    8
    Views:
    312
Loading...

Share This Page