My code compiles just find. But when I try to load the page I keep getting this errror...
error CS0103: The name 'grdExpense' does not exist in the current context
Which is making me thing my Javascript is not correct. Because my site worked until I need to add the webtab to it. And now it can not find any of my controls.
What was working was this java...
var grid = $find('<%= grdExpense.ClientID %>');
var ret = grid.get_behaviors().get_editingCore().get_behaviors().get_rowEditingTemplate();
var row = grid.get_behaviors().get_editingCore().get_behaviors().get_rowAdding().get_row();
ToggleValidators(false);
ret.enterEditMode(row);
I don't know if its the java that is giving me that error, but like I said everythng is compiling fine.
Thanks for your help.
Hello apalcer,
If you need any further assistance with the matter, please let me know.
Hi apalcer,
Your codes should work if grid is a child control in WebTab. Below is example.
<ig:WebTab ID="WebTab1" runat="server" Height="467px" Width="777px"> <Tabs> <ig:ContentTabItem runat="server" Text="Tab 1"> <Template> <ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="True" Height="350px" Width="400px"> </ig:WebDataGrid> </Template> </ig:ContentTabItem> <ig:ContentTabItem runat="server" Text="Tab 2"></ig:ContentTabItem> </Tabs></ig:WebTab><script type="text/javascript"> function findGrid() { var grid = $find('<%=WebDataGrid1.ClientID %>'); alert('grid:'+grid+':'+grid.get_uniqueID()); }</script><input type="button" value="findChild" onclick="findGrid()" />
However, if you use ContentUrl and child (grid) is located in another aspx, then $find(id) will not work, because child is located in iframe which has different document. If that is the case, then you may find reference to that iframe and use its "window" to get its javascript objects. Something like below:
// note: you may use server <%=...%> herevar webtab = $find(clientIdOfWebTab);var tab = webtab.getTabAt(1);var iframe = tab.get_iframe();var win = iframe.contentWindow;// note: you cannot use server <%=...%> here, because grid is located in different aspxvar grid = win.$find(clientIdOfGrid);
You can get a reference to the grid, placed in WebTab by handling the Initialize client-side event of the grid:
<script type="text/javascript"> var grid; function InitGrid(sender, args) { grid = sender; }</script>
Hope this helps.