I have solved my problem in some diffrend way...

D

dada

..... After 3 weeks of my searching for solvation, I have made some new
function and I got selected item correct. But now is again another
problem with refreshing grid, because it writes the right data bu it
doesn`t show it until some refresh isn`t clicked:(...

If someone can help I would preacheate it,
Thanks Dada

<asp:TemplateColumn HeaderText="Institucija">
<HeaderStyle Width="350pt"></HeaderStyle>
<ItemTemplate>
<asp:Label id=Label1 runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Institucije") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList id=DropDownList1 runat="server" Width="239px"
DataMember="Institucije" DataSource="<%# dsDepartmani %>"
DataTextField="Naziv" DataValueField="ID institucije"
SelectedIndex='<%# DajID((string)DataBinder.Eval(Container,
"DataItem.Institucije")) %>'>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>

protected int DajID(string naziv)
{
for (int i=0; i<dsDepartmani.Institucije.DefaultView.Count;i++)
{
if(dsDepartmani.Institucije.DefaultView["Naziv"].ToString()==naziv)
{
return i;
}
}
return 0;
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top