DataGrid Row returing DataRowView question
-
Hi all. See this: <%# someFunction(Container.DataItem) %> and then this: protected string someFunction(object item) { DataRowView drv = (DataRowView)item; //then do stuff with drv to return a value you want return "value"; } Well isn't there a lot of overhead in passing objects around, then casting? Is there a way to pass in the DataRowView directly? Something similar to: <%# DataBinder.Eval(Container, "DataItem.name")%> ...would be great sort of: <%# DataBinder.Eval(Container, "DataItem.DataRowView")%> any ideas very gratefully received. cheers steven
-
Hi all. See this: <%# someFunction(Container.DataItem) %> and then this: protected string someFunction(object item) { DataRowView drv = (DataRowView)item; //then do stuff with drv to return a value you want return "value"; } Well isn't there a lot of overhead in passing objects around, then casting? Is there a way to pass in the DataRowView directly? Something similar to: <%# DataBinder.Eval(Container, "DataItem.name")%> ...would be great sort of: <%# DataBinder.Eval(Container, "DataItem.DataRowView")%> any ideas very gratefully received. cheers steven
sorry everyone - forgot about the tags check box :doh: here it is in full: Hi all. See this: <%# someFunction(Container.DataItem) %> and then this: protected string someFunction(object item) { DataRowView drv = (DataRowView)item; //then do stuff with drv to return a value you want return "value"; } Well isn't there a lot of overhead in passing objects around, then casting? Is there a way to pass in the DataRowView directly? Something similar to: <%# DataBinder.Eval(Container, "DataItem.name")%> ...would be great sort of: <%# DataBinder.Eval(Container, "DataItem.DataRowView")%> any ideas very gratefully received. cheers steven
-
sorry everyone - forgot about the tags check box :doh: here it is in full: Hi all. See this: <%# someFunction(Container.DataItem) %> and then this: protected string someFunction(object item) { DataRowView drv = (DataRowView)item; //then do stuff with drv to return a value you want return "value"; } Well isn't there a lot of overhead in passing objects around, then casting? Is there a way to pass in the DataRowView directly? Something similar to: <%# DataBinder.Eval(Container, "DataItem.name")%> ...would be great sort of: <%# DataBinder.Eval(Container, "DataItem.DataRowView")%> any ideas very gratefully received. cheers steven
Hi Steven, You could always cast it first: <%# someFunction((DataRowView)Container.DataItem) %> protected string someFunction(DataRowView drv) { //then do stuff with drv to return a value you want return "value"; } Marcie http://www.codeproject.com
-
Hi Steven, You could always cast it first: <%# someFunction((DataRowView)Container.DataItem) %> protected string someFunction(DataRowView drv) { //then do stuff with drv to return a value you want return "value"; } Marcie http://www.codeproject.com
mmm - nice one! thank you.