After inserting a new rowhttp://forums.asp.net/t/1773892.aspx/1?After+inserting+a+new+rowFri, 02 Mar 2012 11:15:27 -050017738924851326http://forums.asp.net/p/1773892/4851326.aspx/1?After+inserting+a+new+rowAfter inserting a new row <p>Hi guys,</p> <p>I'm new to Dynamic data I was wondering if anyone could please tell me how to create a new folder within the site directory after inserting a new row? I know how to create the folder using 'System.IO.Directory.CreateDirectory(path);' my only problem is getting that to hit only after an insert.</p> <p>Is it possible to achieve this without coding anything into the field templates or any other template?</p> <p>I thought I had it working by using some of the partial methods such as onNameChanged() within my partial class, but that gets called regardless of whether your inserting, editing or deleting.</p> <p></p> <p>Any help would be really appreciated.</p> <p></p> <p>Thank you in advance</p> 2012-02-26T10:30:37-05:004852760http://forums.asp.net/p/1773892/4852760.aspx/1?Re+After+inserting+a+new+rowRe: After inserting a new row <p>Hi mmokri, you can just handle the FormViews OnInserted even in the Insert page, if this is just for one table you could check the table name there. if this is because you are uploading files the I usually create a fiel upload field template see mine here <a href="http://nuget.org/packages/NotAClue.DynamicData.CustomFieldTemplates">Dynamic Data Custom Field Templates</a></p> 2012-02-27T11:32:55-05:004852800http://forums.asp.net/p/1773892/4852800.aspx/1?Re+After+inserting+a+new+rowRe: After inserting a new row <p>Hi sjnaughton, and thanks for the reply.</p> <p>I'm not uploading files, my aim is to create a new folder structure for every 'theme' that gets inserted.</p> <p>I was initially reluctant to add anything non generic into any of the action pages, but I think I may have to following your instruction.</p> <p></p> <p>I've found the event handler:</p> <p>&nbsp;&nbsp;&nbsp; protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (e.Exception == null || e.ExceptionHandled) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Redirect(table.ListActionPath);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp; }</p> <p></p> <p>Could you please tell me how I would 'check the table name there'?</p> <p>Thanks again :)</p> <p></p> 2012-02-27T11:48:58-05:004852807http://forums.asp.net/p/1773892/4852807.aspx/1?Re+After+inserting+a+new+rowRe: After inserting a new row <p>hi....can u post ur code...</p> 2012-02-27T11:52:27-05:004852816http://forums.asp.net/p/1773892/4852816.aspx/1?Re+After+inserting+a+new+rowRe: After inserting a new row <p>Hi venkatmca008,</p> <p>Thanks for the info, although I know how to create a directory, I just require it to be created after an insert on a specific table</p> <p>Thanks</p> 2012-02-27T11:56:05-05:004852830http://forums.asp.net/p/1773892/4852830.aspx/1?Re+After+inserting+a+new+rowRe: After inserting a new row <p>Yes I can...</p> 2012-02-27T12:00:01-05:004853755http://forums.asp.net/p/1773892/4853755.aspx/1?Re+After+inserting+a+new+rowRe: After inserting a new row <p></p> <blockquote><span class="icon-blockquote"></span> <h4>mmokri</h4> Could you please tell me how I would 'check the table name there'?</blockquote> <p></p> <p>Hello</p> <p>I don't think you can fetch the table name through the event hereAnd if you are using DD's TemplateI think the current table name will be outputted automatically at the top of your pageMaybe you can right click your mouse to see the source of HTML codesand then use js or jQuery to save the table name in the HiddenField and take it out through the HiddenField</p> <p>Plz correct me if I'm wrong</p> <p>Reguards</p> 2012-02-28T00:26:12-05:004854415http://forums.asp.net/p/1773892/4854415.aspx/1?Re+After+inserting+a+new+rowRe: After inserting a new row <p>Hi Decker</p> <p></p> <p>Thanks for the info, I've found a way, perhaps it's not the best was by using the MetaTable object called table decalared at the top of the page, which has a Name property....</p> <p>Which I wrapped inside an if statement like so...</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (table.Name.Equals(&quot;myTblName&quot;))<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p> <p>//create directory</p> <p>}</p> <p></p> <p>Regards</p> <p></p> <p></p> <p></p> <p></p> <p></p> 2012-02-28T08:38:47-05:004860012http://forums.asp.net/p/1773892/4860012.aspx/1?Re+After+inserting+a+new+rowRe: After inserting a new row <p>I don't understand the original question</p> <p></p> <p>Yules</p> 2012-03-02T04:54:47-05:004860624http://forums.asp.net/p/1773892/4860624.aspx/1?Re+After+inserting+a+new+rowRe: After inserting a new row <p>H there, it looks to me like he want some folders on the server for each record, not sure what he wants those folder for though. It looks like it is somthing very spcific for his use case.</p> 2012-03-02T11:15:27-05:00