// get's the list of forms and checks if the list isn't empty public void requestForms() { allForms = cMain.getForms(); if (allForms.Count >= 1) { renderFormElements(allForms); } else { renderInfoMessage("Ohoh! You either deleted the last one or there are no saved forms yet!<br />Please try to create a form first! <a href='Create.aspx'>Back</a>."); } }
// renders the list of forms public void renderFormElements(cForms allForms) { Response.Write("<table><tr><td class='head' width='280'>ID</td><td width='20'></td><td class='head' width='250'>Name</td><td width='20'></td><td class='head' width='250'>Information</td><td width='20'></td><td width='120'></td></tr>"); foreach (var i in allForms) { // cut the name and info for readability reasons if (i.Name.Length > 30) { i.Name = i.Name.Substring(0, 30) + " ..."; } if (i.Info.Length > 30) { i.Info = i.Info.Substring(0, 30) + " ..."; } Response.Write("<tr><td>" + i.ID + "</td><td width='20'></td><td><a href='Form.aspx?type=view&form=" + i.ID + "'>" + i.Name + "</a></td><td width='20'></td><td>" + i.Info + "</td><td width='20'></td><td><a href='Entry.aspx?form=" + i.ID + "'>Entries</a> | <a href='Form.aspx?type=delete&form=" + i.ID + "'>Delete</a></td></tr>"); } Response.Write("</table>"); Response.Write("<input type='button' id='back_button' class='button' value='Back' onclick='window.location.href='Create.aspx'' />"); }
// get's the list of forms and checks if the list isn't empty public void requestForms() { allForms = cMain.getForms(); if (allForms.Count >= 1) renderFormElements(allForms); else renderInfoMessage("Ohoh! You either deleted the last one or there are no saved forms yet!<br />Please try to create a form first! <a href='Create.aspx'>Back</a>."); }
// renders the list of forms public void renderFormElements(cForms allForms) { Response.Write("<table><tr><td class='head' width='280'>ID</td><td width='20'></td><td class='head' width='250'>Name</td><td width='20'></td><td class='head' width='250'>Information</td><td width='20'></td><td width='120'></td></tr>"); foreach (var i in allForms) { // cut the name and info for readability reasons if (i.Name.Length > 30) i.Name = i.Name.Substring(0, 30) + " ..."; if (i.Info.Length > 30) i.Info = i.Info.Substring(0, 30) + " ..."; Response.Write("<tr><td>" + i.ID + "</td><td width='20'></td><td><a href='Form.aspx?type=view&form=" + i.ID + "'>" + i.Name + "</a></td><td width='20'></td><td>" + i.Info + "</td><td width='20'></td><td><a href='Entry.aspx?form=" + i.ID + "'>Entries</a> | <a href='Form.aspx?type=delete&form=" + i.ID + "'>Delete</a></td></tr>"); } Response.Write("</table>"); Response.Write("<input type='button' id='back_button' class='button' value='Back' onclick='window.location.href='Create.aspx'' />"); }
public static cForms getForms() { cForms forms = new cForms(); forms.loadAll(); return forms; }