473,402 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

edit datagrid with dropdownlist

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!
Nov 17 '05 #1
1 977
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 thevalue selected by the user to a function which will return a value ofits 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!
.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
1
by: Stanley J Mroczek | last post by:
I am trying to load a dropdownlist in VB when the edit is clicked in a datagrid. How do i call Sub loaddd to load the dropdownlist <asp:TemplateColumn runat="server" HeaderText="Id Type Option"...
2
by: Stan | last post by:
This is how I access Pieces field in my editable datargid during Update event: protected void grdMain_OnUpdate(Object sender, DataGridCommandEventArgs e) { string Pieces = ((TextBox)...
2
by: NewToDotNet | last post by:
Hi, I am very new to ASP.NET and web programming in general. I have one issue. I have a Datagrid object with Edit template. In one Datagrid row, I have 1 DropdownList, 1 textbox and 1 readonly...
2
by: Dave | last post by:
Hi, I'm building a maintenance form for a table and some of the fields are textboxes (i.e name) and some should be dropdowns (i.e country of origin) When a user clicks 'Edit' in the...
3
by: Tim::.. | last post by:
Can someone please tell me how I go about preselecting an item in a drop drown list when I click the Edit Command in a datagrid? I have tried the following but it doesn't work for me! I would...
2
by: wolfgang wagner | last post by:
hi all! im trying to edit data in a datagrid (like described here: http://aspnet.4guysfromrolla.com/articles/071002-1.aspx) but if i click the edit button i get the following error invalid...
2
by: Gummy | last post by:
Hello All, I have a webpage that has two dropdown listboxes. Based on what is selected in these dropdown listboxes, it filters a DataGrid . That works fine. In the DataGrid , when I go to edit...
2
by: Peter | last post by:
ASP.NET 2003 In the DataGrid how do I select current cell value in the dropdown box when I click on the edit link, currently when I click on the edit link in the DataGrid the dropdown box...
0
by: bh | last post by:
I'm trying to edit data in a datagrid through a dropdown list with different id/text values. The problem comes in when I click the edit button & nothing appears to be happening. Did I do...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.