By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,221 Members | 1,663 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,221 IT Pros & Developers. It's quick & easy.

SelectedIndex of Dropdownlist in Datagrid

P: n/a
Hi All,

I am going to using a editable datagrid, one of the field should be a
dropdownlist, here is my code
<EditItemTemplate>
<asp:DropDownList
ID="INVESTMENT_FUND_ID"
DataSource="<%# getINVESTMENT_FUND() %>"
DataTextField="NAME"
DataValueField="VALUE"
runat="server"
CssClass="table_list_item_text" Width="230px">
</asp:DropDownList>
</EditItemTemplate>

It is fine. But when I want to set the default SelectedIndex, I added
SelectedIndex="<%# getSelectedIndex() %>"
into the aspx, but the error occurs

Parser Error Message: The 'SelectedIndex' property is set only by the
runtime. It cannot be declared.

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032

Any other method I can solve this issue?
Thank you!

Regards,
Alan

Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

For setting default selected index for dropdownlist in datagrid, Check out
"Displaying a Drop-Down List in Edit Mode" section in this article,
http://msdn.microsoft.com/library/de...verControl.asp

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Kay Chan" <ka******@townsoft.com.hk> wrote in message
news:#t*************@TK2MSFTNGP12.phx.gbl...
Hi All,

I am going to using a editable datagrid, one of the field should be a
dropdownlist, here is my code
<EditItemTemplate>
<asp:DropDownList
ID="INVESTMENT_FUND_ID"
DataSource="<%# getINVESTMENT_FUND() %>"
DataTextField="NAME"
DataValueField="VALUE"
runat="server"
CssClass="table_list_item_text" Width="230px">
</asp:DropDownList>
</EditItemTemplate>

It is fine. But when I want to set the default SelectedIndex, I added
SelectedIndex="<%# getSelectedIndex() %>"
into the aspx, but the error occurs

Parser Error Message: The 'SelectedIndex' property is set only by the
runtime. It cannot be declared.

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

Any other method I can solve this issue?
Thank you!

Regards,
Alan

Nov 19 '05 #2

P: n/a
Thank you!

"Saravana" <sa******@sct.co.in> wrote in message
news:7g*****************@news.cpqcorp.net...

For setting default selected index for dropdownlist in datagrid, Check out
"Displaying a Drop-Down List in Edit Mode" section in this article,
http://msdn.microsoft.com/library/de...verControl.asp

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Kay Chan" <ka******@townsoft.com.hk> wrote in message
news:#t*************@TK2MSFTNGP12.phx.gbl...
Hi All,

I am going to using a editable datagrid, one of the field should be a
dropdownlist, here is my code
<EditItemTemplate>
<asp:DropDownList
ID="INVESTMENT_FUND_ID"
DataSource="<%# getINVESTMENT_FUND() %>"
DataTextField="NAME"
DataValueField="VALUE"
runat="server"
CssClass="table_list_item_text" Width="230px">
</asp:DropDownList>
</EditItemTemplate>

It is fine. But when I want to set the default SelectedIndex, I added
SelectedIndex="<%# getSelectedIndex() %>"
into the aspx, but the error occurs

Parser Error Message: The 'SelectedIndex' property is set only by the
runtime. It cannot be declared.

Version Information: Microsoft .NET Framework Version:1.1.4322.2032;

ASP.NET
Version:1.1.4322.2032

Any other method I can solve this issue?
Thank you!

Regards,
Alan


Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.