Search Results

Search found 85 results on 4 pages for 'databinder'.

Page 3/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Pass Parameter to LinqDataSource "OnSelecting" for Stored Procedure

    - by rockinthesixstring
    I'm building a semi-elaborate RadGrid where within my NestedViewTemplate I want to have a LinqDataSource that uses a Stored Procedure to get data from the database. Here's what I have so far <asp:HiddenField runat="server" ID="HiddenID" Value='<%#DataBinder.Eval(Container.DataItem, "ID")%>' /> <asp:LinqDataSource ID="LinqDataSource1" runat="server" OnSelecting="LinqDataSource_Selecting"> <WhereParameters> <asp:ControlParameter ControlID="HiddenID" PropertyName="ID" Type="String" Name="ID" /> </WhereParameters> </asp:LinqDataSource> any my Code Behind... Protected Sub LinqDataSource_Selecting(ByVal sender As Object, ByVal e As LinqDataSourceSelectEventArgs) Dim hdc As New DAL.HealthMonitorDataContext() e.Result = hdc.bt_HealthMonitor_GetByID(Integer.Parse(e.WhereParameters("ID"))) End Sub but unfortunately hdc.bt_HealthMonitor_GetByID(Integer.Parse(e.WhereParameters("ID"))) isn't playing nice... Exception Details: System.FormatException: Input string was not in a correct format.

    Read the article

  • Asp.NET custom templated datalist throws argument out of range (index) on button press

    - by MrTortoise
    I have a class BaseTemplate public abstract class BaseTemplate : ITemplate This adds the controls, and provides abstract methods to implement in the inheriting class. The inheriting class then adds its html according to its data source and manages the data binding. This all works fine - I get the control appearing with properly parsed html. The problem is that the base class adds controls into the template that have their own CommandName arguments; the idea is that the class that implements the custom templated dataList will provide the logic of setting the Selected and Edit Indexes. This class also manages the data binding, etc. It sets all of the templates on the datalist in the Init method (which was another cause of this exception). The exception gets thrown when I hit one of these buttons - I have tried hooking up both their click and command events everywhere in case this was the problem. I have also ensured that their command names do not match any of the system ones. The stack trace does not include any references to my methods or objects which is why I am so stuck. It is the most unhelpful message I can imagine. The really frustrating thing is that I cannot get a breakpoint to fire - i.e. the problem is happening after I click the button, but before and of my code can execute. The last time this exception happened was when I had this code in a user control and was assigning the templates to the datalist in the PageLoad. I moved these into init to fix that problem; however, this is a problem that was there then and I have no idea what is causing it let alone how to solve it (and index out of range doesn't really help without knowing what index.) The Exception Details Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index The Stack Trace: [ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index] System.Web.UI.ControlCollection.get_Item(Int32 index) +8665582 System.Web.UI.WebControls.DataList.GetItem(ListItemType itemType, Int32 repeatIndex) +8667655 System.Web.UI.WebControls.DataList.System.Web.UI.WebControls.IRepeatInfoUser.GetItemStyle(ListItemType itemType, Int32 repeatIndex) +11 System.Web.UI.WebControls.RepeatInfo.RenderVerticalRepeater(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl) +8640873 System.Web.UI.WebControls.RepeatInfo.RenderRepeater(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl) +27 System.Web.UI.WebControls.DataList.RenderContents(HtmlTextWriter writer) +208 System.Web.UI.WebControls.BaseDataList.Render(HtmlTextWriter writer) +30 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32 System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 System.Web.UI.Page.Render(HtmlTextWriter writer) +29 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266 The code Base class: public abstract class BaseTemplate : ITemplate { ListItemType _templateType; public BaseTemplate(ListItemType theTemplateType) { _templateType = theTemplateType; } public ListItemType ListItemType { get { return _templateType; } } #region ITemplate Members public void InstantiateIn(Control container) { PlaceHolder ph = new PlaceHolder(); container.Controls.Add(ph); Literal l = new Literal(); switch (_templateType) { case ListItemType.Header: { ph.Controls.Add(new LiteralControl(@"<table><tr>")); InstantiateInHeader(ph); ph.Controls.Add(new LiteralControl(@"</tr>")); break; } case ListItemType.Footer: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInFooter(ph); ph.Controls.Add(new LiteralControl(@"</tr></table>")); break; } case ListItemType.Item: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInItem(ph); ph.Controls.Add(new LiteralControl(@"<td>")); Button select = new Button(); select.ID = "btnSelect"; select.CommandName = "SelectRow"; select.Text = "Select"; ph.Controls.Add(select); ph.Controls.Add(new LiteralControl(@"</td>")); ph.Controls.Add(new LiteralControl(@"</tr>")); ph.DataBinding += new EventHandler(ph_DataBinding); break; } case ListItemType.AlternatingItem: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInAlternatingItem(ph); ph.Controls.Add(new LiteralControl(@"<td>")); Button select = new Button(); select.ID = "btnSelect"; select.CommandName = "SelectRow"; select.Text = "Select"; ph.Controls.Add(select); ph.Controls.Add(new LiteralControl(@"</td>")); ph.Controls.Add(new LiteralControl(@"</tr>")); ph.DataBinding+=new EventHandler(ph_DataBinding); break; } case ListItemType.SelectedItem: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInItem(ph); ph.Controls.Add(new LiteralControl(@"<td>")); Button edit = new Button(); edit.ID = "btnEdit"; edit.CommandName = "EditRow"; edit.Text = "Edit"; ph.Controls.Add(edit); Button delete = new Button(); delete.ID = "btnDelete"; delete.CommandName = "DeleteRow"; delete.Text = "Delete"; ph.Controls.Add(delete); ph.Controls.Add(new LiteralControl(@"</td>")); ph.Controls.Add(new LiteralControl(@"</tr>")); ph.DataBinding += new EventHandler(ph_DataBinding); break; } case ListItemType.EditItem: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInEdit(ph); ph.Controls.Add(new LiteralControl(@"<td>")); Button save = new Button(); save.ID = "btnSave"; save.CommandName = "SaveRow"; save.Text = "Save"; ph.Controls.Add(save); Button cancel = new Button(); cancel.ID = "btnCancel"; cancel.CommandName = "CancelRow"; cancel.Text = "Cancel"; ph.Controls.Add(cancel); ph.Controls.Add(new LiteralControl(@"</td>")); ph.Controls.Add(new LiteralControl(@"</tr>")); ph.DataBinding += new EventHandler(ph_DataBinding); break; } case ListItemType.Separator: { InstantiateInSeperator(ph); break; } } } void ph_DataBinding(object sender, EventArgs e) { DataBindingOverride(sender, e); } /// <summary> /// the controls placed into the PlaceHolder will get wrapped in &lt;table&gt;&lt;tr&gt; &lt;/tr&gt;. I.e. you need to provide the column names wrapped in &lt;td&gt;&lt;/td&gt; tags. /// </summary> /// <param name="header"></param> public abstract void InstantiateInHeader(PlaceHolder ph); /// <summary> /// the controls will have a column added after them and so require each column to be properly wrapped in &lt;td&gt;&lt;/td&gt; tags. The &lt;tr&gt;&lt;/tr&gt; is handled in the base class. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInItem(PlaceHolder ph); /// <summary> /// the controls will have a column added after them and so require each column to be properly wrapped in &lt;td&gt;&lt;/td&gt; tags. The &lt;tr&gt;&lt;/tr&gt; is handled in the base class. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInAlternatingItem(PlaceHolder ph); /// <summary> /// the controls will have a column added after them and so require each column to be properly wrapped in &lt;td&gt;&lt;/td&gt; tags. The &lt;tr&gt;&lt;/tr&gt; is handled in the base class. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInEdit(PlaceHolder ph); /// <summary> /// Any html used in the footer will have &lt;/tr&gt;&lt;table&gt; appended to the end. /// &lt;tr&gt; will be appended to the front. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInFooter(PlaceHolder ph); /// <summary> /// the controls will have a column added after them and so require each column to be properly wrapped in &lt;td&gt;&lt;/td&gt; tags. The &lt;tr&gt;&lt;/tr&gt; is handled in the base class. /// Adds Delete and Edit Buttons after the table contents. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInSelectedItem(PlaceHolder ph); /// <summary> /// The base class provides no &lt;tr&gt;&lt;/tr&gt; tags /// </summary> /// <param name="ph"></param> public abstract void InstantiateInSeperator(PlaceHolder ph); /// <summary> /// Use this method to bind the controls to their data. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public abstract void DataBindingOverride(object sender, EventArgs e); #endregion } Inheriting class: public class NominalGroupTemplate : BaseTemplate { public NominalGroupTemplate(ListItemType theListItemType) : base(theListItemType) { } public override void InstantiateInHeader(PlaceHolder ph) { ph.Controls.Add(new LiteralControl(@"<td>ID</td><td>Group</td><td>IsPositive</td>")); } public override void InstantiateInItem(PlaceHolder ph) { ph.Controls.Add(new LiteralControl(@"<td>")); Label lblID = new Label(); lblID.ID = "lblID"; ph.Controls.Add(lblID); ph.Controls.Add(new LiteralControl(@"</td><td>")); Label lblGroup = new Label(); lblGroup.ID = "lblGroup"; ph.Controls.Add(lblGroup); ph.Controls.Add(new LiteralControl(@"</td><td>")); CheckBox chkIsPositive = new CheckBox(); chkIsPositive.ID = "chkIsPositive"; chkIsPositive.Enabled = false; ph.Controls.Add(chkIsPositive); ph.Controls.Add(new LiteralControl(@"</td>")); } public override void InstantiateInAlternatingItem(PlaceHolder ph) { InstantiateInItem(ph); } public override void InstantiateInEdit(PlaceHolder ph) { ph.Controls.Add(new LiteralControl(@"<td>")); Label lblID = new Label(); lblID.ID = "lblID"; ph.Controls.Add(lblID); ph.Controls.Add(new LiteralControl(@"</td><td>")); TextBox txtGroup = new TextBox(); txtGroup.ID = "txtGroup"; txtGroup.Visible = true; txtGroup.Enabled = true ; ph.Controls.Add(txtGroup); ph.Controls.Add(new LiteralControl(@"</td><td>")); CheckBox chkIsPositive = new CheckBox(); chkIsPositive.ID = "chkIsPositive"; chkIsPositive.Visible = true; chkIsPositive.Enabled = true ; ph.Controls.Add(chkIsPositive); ph.Controls.Add(new LiteralControl(@"</td>")); } public override void InstantiateInFooter(PlaceHolder ph) { InstantiateInHeader(ph); } public override void InstantiateInSelectedItem(PlaceHolder ph) { ph.Controls.Add(new LiteralControl(@"<td>")); Label lblID = new Label(); lblID.ID = "lblID"; ph.Controls.Add(lblID); ph.Controls.Add(new LiteralControl(@"</td><td>")); TextBox txtGroup = new TextBox(); txtGroup.ID = "txtGroup"; txtGroup.Visible = true; txtGroup.Enabled = false; ph.Controls.Add(txtGroup); ph.Controls.Add(new LiteralControl(@"</td><td>")); CheckBox chkIsPositive = new CheckBox(); chkIsPositive.ID = "chkIsPositive"; chkIsPositive.Visible = true; chkIsPositive.Enabled = false; ph.Controls.Add(chkIsPositive); ph.Controls.Add(new LiteralControl(@"</td>")); } public override void InstantiateInSeperator(PlaceHolder ph) { } public override void DataBindingOverride(object sender, EventArgs e) { PlaceHolder ph = (PlaceHolder)sender; DataListItem li = (DataListItem)ph.NamingContainer; int id = Convert.ToInt32(DataBinder.Eval(li.DataItem, "ID")); string group = (string)DataBinder.Eval(li.DataItem, "Group"); bool isPositive = Convert.ToBoolean(DataBinder.Eval(li.DataItem, "IsPositive")); switch (this.ListItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: { ((Label)ph.FindControl("lblID")).Text = id.ToString(); ((Label)ph.FindControl("lblGroup")).Text = group; ((CheckBox)ph.FindControl("chkIsPositive")).Text = isPositive.ToString(); break; } case ListItemType.EditItem: case ListItemType.SelectedItem: { ((TextBox)ph.FindControl("lblID")).Text = id.ToString(); ((TextBox)ph.FindControl("txtGroup")).Text = group; ((CheckBox)ph.FindControl("chkIsPositive")).Text = isPositive.ToString(); break; } } } } From here I added the control to a page the code behind public partial class NominalGroupbroke : System.Web.UI.UserControl { public void SetNominalGroupList(IList<BONominalGroup> theNominalGroups) { XElement data = Serialiser<BONominalGroup>.SerialiseObjectList(theNominalGroups); ViewState.Add("nominalGroups", data.ToString()); dlNominalGroup.DataSource = theNominalGroups; dlNominalGroup.DataBind(); } protected void Page_init() { dlNominalGroup.HeaderTemplate = new NominalGroupTemplate(ListItemType.Header); dlNominalGroup.ItemTemplate = new NominalGroupTemplate(ListItemType.Item); dlNominalGroup.AlternatingItemTemplate = new NominalGroupTemplate(ListItemType.AlternatingItem); dlNominalGroup.SeparatorTemplate = new NominalGroupTemplate(ListItemType.Separator); dlNominalGroup.SelectedItemTemplate = new NominalGroupTemplate(ListItemType.SelectedItem); dlNominalGroup.EditItemTemplate = new NominalGroupTemplate(ListItemType.EditItem); dlNominalGroup.FooterTemplate = new NominalGroupTemplate(ListItemType.Footer); } protected void Page_Load(object sender, EventArgs e) { dlNominalGroup.ItemCommand += new DataListCommandEventHandler(dlNominalGroup_ItemCommand); } void dlNominalGroup_Init(object sender, EventArgs e) { dlNominalGroup.HeaderTemplate = new NominalGroupTemplate(ListItemType.Header); dlNominalGroup.ItemTemplate = new NominalGroupTemplate(ListItemType.Item); dlNominalGroup.AlternatingItemTemplate = new NominalGroupTemplate(ListItemType.AlternatingItem); dlNominalGroup.SeparatorTemplate = new NominalGroupTemplate(ListItemType.Separator); dlNominalGroup.SelectedItemTemplate = new NominalGroupTemplate(ListItemType.SelectedItem); dlNominalGroup.EditItemTemplate = new NominalGroupTemplate(ListItemType.EditItem); dlNominalGroup.FooterTemplate = new NominalGroupTemplate(ListItemType.Footer); } void dlNominalGroup_DataBinding(object sender, EventArgs e) { } void deleteNominalGroup(int index) { XElement data = XElement.Parse(Convert.ToString( ViewState["nominalGroups"] )); IList<BONominalGroup> list = Serialiser<BONominalGroup>.DeserialiseObjectList(data); FENominalGroup.DeleteNominalGroup(list[index].ID); list.RemoveAt(index); data = Serialiser<BONominalGroup>.SerialiseObjectList(list); ViewState["nominalGroups"] = data.ToString(); dlNominalGroup.DataSource = list; dlNominalGroup.DataBind(); } void updateNominalGroup(DataListItem theItem) { XElement data = XElement.Parse(Convert.ToString( ViewState["nominalGroups"])); IList<BONominalGroup> list = Serialiser<BONominalGroup>.DeserialiseObjectList(data); BONominalGroup old = list[theItem.ItemIndex]; BONominalGroup n = new BONominalGroup(); byte id = Convert.ToByte(((TextBox)theItem.FindControl("lblID")).Text); string group = ((TextBox)theItem.FindControl("txtGroup")).Text; bool isPositive = Convert.ToBoolean(((CheckBox)theItem.FindControl("chkIsPositive")).Text); n.ID = id; n.Group = group; n.IsPositive = isPositive; FENominalGroup.UpdateNominalGroup(old, n); list[theItem.ItemIndex] = n; data = Serialiser<BONominalGroup>.SerialiseObjectList(list); ViewState["nominalGroups"] = data.ToString(); } void dlNominalGroup_ItemCommand(object source, DataListCommandEventArgs e) { DataList l = (DataList)source; switch (e.CommandName) { case "SelectRow": { if (l.EditItemIndex == -1) { l.SelectedIndex = e.Item.ItemIndex; l.EditItemIndex = -1; } break; } case "EditRow": { if (l.SelectedIndex == e.Item.ItemIndex) { l.EditItemIndex = e.Item.ItemIndex; } break; } case "DeleteRow": { deleteNominalGroup(e.Item.ItemIndex); l.EditItemIndex = -1; try { l.SelectedIndex = e.Item.ItemIndex; } catch { l.SelectedIndex = -1; } break; } case "CancelRow": { l.SelectedIndex = l.EditItemIndex; l.EditItemIndex = -1; break; } case "SaveRow": { updateNominalGroup(e.Item); try { l.SelectedIndex = e.Item.ItemIndex; } catch { l.SelectedIndex = -1; } l.EditItemIndex = -1; break; } } } Lots of code there, I'm afraid, but it should build. Thanks if anyone manages to spot my silliness. The BONominalGroup class (please ignore my crazy getHash override, I'm not proud of it). IAudit can just be an empty interface here and all will be fine. It used to inherit from another class, I have cleaned that out - so the serialization logic may be broken here. public class BONominalGroup { public BONominalGroup() #region Fields and properties private Int16 _ID; public Int16 ID { get { return _ID; } set { _ID = value; } } private string _group; public string Group { get { return _group; } set { _group = value; } } private bool _isPositve; public bool IsPositive { get { return _isPositve; } set { _isPositve = value; } } #endregion public override bool Equals(object obj) { bool retVal = false; BONominalGroup ng = obj as BONominalGroup; if (ng!=null) if (ng._group == this._group && ng._ID == this.ID && ng.IsPositive == this.IsPositive) { retVal = true; } return retVal; } public override int GetHashCode() { return ToString().GetHashCode(); } public override string ToString() { return "BONominalGroup{ID:" + this.ID.ToString() + ",Group:" + this.Group.ToString() + ",IsPositive:" + this.IsPositive.ToString() + "," + "}"; } #region IXmlSerializable Members public override void ReadXml(XmlReader reader) { reader.ReadStartElement("BONominalGroup"); this.ID = Convert.ToByte(reader.ReadElementString("id")); this.Group = reader.ReadElementString("group"); this.IsPositive = Convert.ToBoolean(reader.ReadElementString("isPositive")); base.ReadXml(reader); reader.ReadEndElement(); } public override void WriteXml(XmlWriter writer) { writer.WriteElementString("id", this.ID.ToString()); writer.WriteElementString("group", this.Group); writer.WriteElementString("isPositive", this.IsPositive.ToString()); // writer.WriteStartElement("BOBase"); // base.WriteXml(writer); writer.WriteEndElement(); } #endregion }

    Read the article

  • Passing additional arguments into the OnClick event handler of a LinkButton using Javascript

    - by Jens Ameskamp
    Hi! I have a ASP.NET Website, where, in a GridView item template, automatically populated by a LinqDataSource, there is a LinkButton defined as follows: <asp:LinkButton ID="RemoveLinkButton" runat="server" CommandName="Remove" CommandArgument='<%# DataBinder.GetPropertyValue(GetDataItem(), "Id")%>' OnCommand="removeVeto_OnClick" OnClientClick='return confirm("Are you sure?");' Text="Remove Entry" /> This works fine. Whenever the Button is Clicked, a confirmation dialog is displayed. What I am trying to do now, is to allow the user to enter a reason for the removal, and pass this on the the OnClick event handler. How would I do this? I tried OnClientClick='return prompt("Enter your reason!");', but, of course, that did not work =)

    Read the article

  • Looking for a method to replace a string with a hyperlink

    - by Richard West
    I have a usercontrol in an asp web forms application that I am working on in C#. I am binding to a repeater and outputting a field of information, named "Text", using the following syntax: <%# DataBinder.Eval(Container.DataItem, "Text") %> I am looking for a method that will allow my to search for a keyword within the string that is returned from above, and replace that string with a hyperlink such as <a href="www.anysite.com/keyword">keyword</a>. I'm not very familer with user controls and getting data back in this manner so I am looking for advice on how this might be best handled. Thanks!

    Read the article

  • Setting ID to a control inside repeater itemtemplate

    - by toraan
    Inside repeater's itemtemplate I have a Panel server control. I need to assign special Id for it, because I need to work with some javascript functions that use this Id. In repeater ItemDataBound event I have this: pnlButtonsPanel.ID = pnlButtonsPanel.ID + DataBinder.Eval(e.Item.DataItem, "ID"); But this solution is not good because after a postback the page is re -rendered and I lose the new ID. (And I don't want to rebind repeater after every postback) I tried to set the ID on aspx page like that: <asp:Panel id='<%# Eval("ID") %>' and some other variations but always get compile errors.

    Read the article

  • asp Repeater ItemTemplate - eval whole object

    - by Tomasz Bitowt
    Currently I am using asp:Repeater like this: <asp:Repeater ID="itemsRepeater" runat="server"> <ItemTemplate> <my:Button runat="server" Title='<%# DataBinder.Eval(Container.DataItem, "Title") %>' /> </ItemTemplate> </asp:Repeater> But now, I would like to send whole model to my:Button control like: <asp:Repeater ID="itemsRepeater" runat="server"> <ItemTemplate> <my:TabListButton runat="server" Mode;='<%# this %>' /> </ItemTemplate> </asp:Repeater> Could you tell me how to handle that?

    Read the article

  • How to access referenced table from ASPX in-line code (datagridview control)

    - by Grant
    Hi, i am trying to bind data to a datagridview control on an ASPX webpage and am using something like this.. <asp:TemplateField HeaderText="MyField"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "MyField") %> </ItemTemplate> </asp:TemplateField> the problem i am having is that the data for the 'MyField' field is actually an integer that is a reference to a string value in another sql table. Does anyone know how i can reformat my code line above to show the string value instead of the int value?

    Read the article

  • How can I change column fore color in DataGridview as per condition?

    - by Ashish
    hi, i have one table like employee and one of its row is 'status' if status value is 'approve' then i want to show that row in green color and else i want to show it in red color. i have tried following but not working if (e.Row.RowType == DataControlRowType.Header) { string status = DataBinder.Eval(e.Row.DataItem, "IsApprove").ToString(); if (status == "pending") { e.Row.ForeColor = System.Drawing.Color.Red; // Change the row's Text color } } ALSO THIS ONE private void gvleavedetail_cellformatting(object sender, datagridviewcellformattingeventargs e) { // if the column is the artist column, check the // value. if (this.gvleavedetail.columns[e.columnindex].name == "artist") { if (e.value != null) { // check for the string "pink" in the cell. string stringvalue = (string)e.value; stringvalue = stringvalue.tolower(); if (stringvalue == "high") { e.cellstyle.backcolor = color.pink; } } } But in this case i'm getting error for datagridviewcellformattingeventargs I'm using VS2010

    Read the article

  • checking & unchecking a HTML checkbox inside repeater based on database value

    - by subash
    i have a repeater control with item templates having check boxes,and i need the check boxes inside the repeatercontrol to be checked based on the database value of a column field "enabled" of bool type of either true or false. the code is as below what modification should i make to check and uncheck the check box? <asp:Repeater ID="rptrDashboardIssue" runat="server"> <ItemTemplate> <%issueEnum += 1;%> <div style="margin-left: -20px; position: absolute;" id="divModificationCaseflow"> <input type="checkbox" name="chkModificationCaseflow" id="chkModificationCaseflowIssue<%=issueEnum%>" checked="<%# DataBinder.Eval(Container.DataItem, "enabled")%>" /> </div> </ItemTemplate> </asp:Repeater>

    Read the article

  • a value that shows in select mode disappears in edit mode from a gridview column

    - by Jbob Johan
    i have a gridview(GridView1) with a few Bound Fields first one is Date (ActivityDate) from a table named "tblTime" i have managed to add one extra colum (manually), that is not bound that shows dayInWeek value according to the "ActivityDate" field programtically in CodeBehind but when i enter into Edit Mode , all Bound fields are showing their values correctly but the one column i have added manually will not show the value as it did in "select mode"(first mode b4 trying to edit) while im not a great dibbagger i have manged to view the cell's value (GridView1.Rows[e.NewEditIndex].Cells[1].Text) which does hold on to the day in week value but it does not appear in gridview edit mode only this is some of the code protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[0].Text = "?????"; //Activity Date (in hebrew) e.Row.Cells[1].Text = "??? ?????"; //DayinWeek e.Row.Cells[2].Text = "??????"; //ActivityType (work seek vacation) named Reason e.Row.Cells[3].Text = "??? ?????"; //time finish (to Work) e.Row.Cells[4].Text = "??? ?????"; //Time out (of work) } if (e.Row.RowType == DataControlRowType.DataRow) { if (Convert.ToBoolean(ViewState["theSubIsclckd"]) == true) //if submit button clicked { try { string twekday1 = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ActiveDate")); twekday1 = twekday1.Remove(9, 11); //geting date only without the time- portion string[] arymd = twekday1.Split('/'); // spliting [d m y] in order to make int day = Convert.ToInt32(arymd[1]); // it into [m d y] ...also requierd int month = Convert.ToInt32(arymd[0]); // when i update the table int year = Convert.ToInt32(arymd[2]); DateTime ILDateInit = new DateTime(year, month, day); //finally extracting Day CultureInfo ILci = CultureInfo.CreateSpecificCulture("he-IL"); // in week //from the converted activity date string MyIL_DayInWeek = ILDateInit.ToString("dddd", ILci); ViewState["MyIL_DayInWeek"] = MyIL_DayInWeek; e.Row.Cells[1].Text = MyIL_DayInWeek; string displayReason = DataBinder.Eval(e.Row.DataItem, "Reason").ToString(); e.Row.Cells[2].Text = displayReason; } catch (System.Exception excep) { Js.functions.but bb = new Js.functions.but(); bb.buttonName = "rex"; bb.documentwrite = true; bb.testCsVar = excep.ToString(); bb.f1(bb); // this was supposed to throw exep in javaScript injected from code behid - alert } // just in case.. } } so that works for the non edit period of time then when i hit the edit ... no day in week shows THE aspX - after selcting date... name etc' , click on button to display gridview: <asp:Button ID="TheSubB" runat="server" Text="???" onclick="TheSubB_Click" /> <asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound" onrowediting="GridView1_RowEditing" onrowcancelingedit="GridView1_RowCancelingEdit" OnRowUpdating="GridView1_RowUpdating" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" AutoGenerateColumns="False" DataKeyNames="tId" DataSourceID="SqlDataSource1" style="z-index: 1; left: 0%; top: 0%; position: relative; width: 812px; height: 59px; font-family:Arial; text-align: center;" AllowSorting="True" > <AlternatingRowStyle BackColor="PaleGoldenrod" /> <Columns> <asp:BoundField DataField="ActiveDate" HeaderText="ActiveDate" SortExpression="ActiveDate" ControlStyle-Width="70" DataFormatString="{0:dd/MM/yyyy}" > <ControlStyle Width="70px" /> </asp:BoundField> <asp:TemplateField HeaderText="???.???.??"> <EditItemTemplate> <asp:TextBox ID="dayinW_EditTB" runat="server"></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="dayInW_editLabel" runat="server"></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Reason" HeaderText="???? ?????" SortExpression="Reason" ControlStyle-Width="50"> <ControlStyle Width="50px" /> </asp:BoundField> <asp:BoundField DataField="TimeOut" HeaderText="TimeOut" SortExpression="TimeOut" ControlStyle-Width="50" DataFormatString="{0:HH:mm}" > <ControlStyle Width="50px"></ControlStyle> </asp:BoundField> <asp:BoundField DataField="TimeIn" HeaderText="TimeIn" SortExpression="TimeIn" ControlStyle-Width="50" DataFormatString="{0:HH:mm}" > <ControlStyle Width="50px"></ControlStyle> </asp:BoundField> <asp:TemplateField HeaderText="????" > <EditItemTemplate> <asp:ImageButton width="15" Height="15" ImageUrl="~/images/edit.png" runat="server" CausesValidation="True" CommandName="Update" Text="Update"> </asp:ImageButton> <asp:ImageButton Width="15" Height="15" ImageUrl="images/cancel.png" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:ImageButton> </EditItemTemplate> <ItemTemplate> <asp:ImageButton width="25" Height="15" ImageUrl="images/edit.png" ID="EditIB" runat="server" CausesValidation="False" CommandName="Edit" AlternateText="????"></asp:ImageButton> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="???"> <ItemTemplate> <asp:ImageButton width="15" Height="15" ImageUrl="images/Delete.png" ID="DeleteIB" runat="server" CommandName="Delete" AlternateText="???" /> </ItemTemplate> </asp:TemplateField> </Columns> <FooterStyle BackColor="Tan" /> <HeaderStyle BackColor="Tan" Font-Bold="True" /> <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" /> <SortedAscendingCellStyle BackColor="#FAFAE7" /> <SortedAscendingHeaderStyle BackColor="#DAC09E" /> <SortedDescendingCellStyle BackColor="#E1DB9C" /> <SortedDescendingHeaderStyle BackColor="#C2A47B" /> </asp:GridView>

    Read the article

  • How to get record value from LinqDataSource via Code Behind

    - by rockinthesixstring
    I've got a LinqDataSource that retrieves a single record. Protected Sub LinqDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles LinqDataSource1.Selecting Dim BizForSaleDC As New DAL.BizForSaleDataContext e.Result = BizForSaleDC.bt_BizForSale_GetByID(e.WhereParameters("ID")).FirstOrDefault End Sub I'd like to be able to retrieve the values of said DataSource using the Page_Load function. Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load 'Get the right usercontrol' Dim ctrl As UserControl Select Case DataBinder.Eval(LINQDATASOURCE_SOMETHING.DataItem, "AdType") Case 1 : ctrl = DirectCast(Me.FindControl("Default1"), UserControl) Case 2 : ctrl = DirectCast(Me.FindControl("Default1"), UserControl) Case 3 : ctrl = DirectCast(Me.FindControl("ValuPro1"), UserControl) Case 4 : ctrl = DirectCast(Me.FindControl("ValuPro1"), UserControl) Case Else : ctrl = Nothing End Select 'set the control to visible' ctrl.Visible = True End Sub But obviously the code above doesn't work... I'm just wondering if there's a way to make it work. Here is the full markup <body> <form id="form1" runat="server"> <asp:LinqDataSource ID="LinqDataSource1" runat="server"> <WhereParameters> <asp:QueryStringParameter ConvertEmptyStringToNull="true" Name="ID" QueryStringField="ID" Type="Int32" /> </WhereParameters> </asp:LinqDataSource> <uc:Default ID="Default1" runat="server" Visible="false" /> <uc:ValuPro ID="ValuPro1" runat="server" Visible="false" /> </form> </body> </html> Basically what happens is the appropriate usercontrol is enabled and that usercontrol inherits the LinqDataSource and displays the appropriate information. EDIT: It's working now with the code below, however, since I'm really not into hitting the database multiple times for the same info, I'd prefer to get the value from the DataSource. 'Query the database' Dim _ID As Integer = Convert.ToInt32(Request.QueryString("ID")) Dim BizForSaleDC As New BizForSaleDataContext Dim results = BizForSaleDC.bt_BizForSale_GetByID(_ID).FirstOrDefault 'Get the right usercontrol' Dim ctrl As UserControl Select Case results.AdType Case 1 : ctrl = DirectCast(Me.FindControl("Default1"), UserControl) Case 2 : ctrl = DirectCast(Me.FindControl("Default1"), UserControl) Case 3 : ctrl = DirectCast(Me.FindControl("ValuPro1"), UserControl) Case 4 : ctrl = DirectCast(Me.FindControl("ValuPro1"), UserControl) Case Else : ctrl = Nothing End Select

    Read the article

  • Asp net aspx page and webcontrol issue

    - by Josemalive
    Hello, I have a class that inherits from Page, called APage. public abstract class APage: Page { protected Repeater ExampleRepeater; .... protected override void OnLoad(EventArgs e) { if (null != ExampleRepeater) { ExampleRepeater.DataSource = GetData(); ExampleRepeater.DataBind(); } base.OnLoad(e); } } For other hand i have an aspx page called Default that inherits from this APage: public partial class Default : APage { } on the design part of this Default page, i have a repeater: <asp:Repeater ID="ExampleRepeater" runat="server"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "Name") %><br/> </ItemTemplate> </asp:Repeater> This repeater is datasourced at the base APage load event, but at this level this web control is null. Do you have any idea why the control is null in the base page? Thanks in advance. Best Regards. Jose.

    Read the article

  • If statement with dataitems in markup

    - by Eric
    I am trying to write an if statement to decide whether or not to display a field. I'm using a listview. <telerik:RadListView ID="RadListView4" runat="server" ItemPlaceholderID="WitnessPlaceHolder" DataSourceID="SqlDataSource5"> <LayoutTemplate> <asp:PlaceHolder ID="WitnessPlaceHolder" runat="server" /> </LayoutTemplate> <ItemTemplate> <center> <fieldset style="float: left; width: 280px;"> <legend> <%# Eval("title").ToString()%> </legend> <table> <tr> <td align="center"> <%if (DataBinder.Eval(Container.DataItem,"field").Equals("C")) Response.Write(Eval("field"));%> </td> How can I write the above if statement in the markup?? What i have doesn't work.

    Read the article

  • adding multiple <asp:Hyperlink>s into a repeater

    - by Colin Pickard
    I have a repeater control, and I want to put an unknown number of <asp:Hyperlink>s into the template, for example if you start with this: <asp:Repeater runat="server" ID="PetsRepeater"> <ItemTemplate> <%#DataBinder.Eval(Container.DataItem, "Owner")%> <%#this.ListPets(Container.DataItem)%> </ItemTemplate> </asp:Repeater> and in code behind: public partial class test1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { PetOwner p = new PetOwner() { Owner = "Jimmy", PetNames = new List<String>() { "Nemo", "Dory" } }; List<PetOwner> PetOwners = new List<PetOwner>() { p }; PetsRepeater.DataSource = PetOwners; PetsRepeater.DataBind(); } } protected String ListPets(Object PetOwner) { StringBuilder sb = new StringBuilder(); foreach (String Name in ((PetOwner)PetOwner).PetNames) { if (sb.Length > 0) sb.Append(", "); sb.Append(Name); } return sb.ToString(); } } class PetOwner { public String Owner; public List<String> PetNames; } Now suppose instead of having the string "Nemo, Dory" in my repeater, I want something like this: <asp:HyperLink runat=server Text="Nemo" NavigateUrl="Pet.aspx?Name=Nemo" />, <asp:HyperLink runat=server Text="Dory" NavigateUrl="Pet.aspx?Name=Dory" /> How can I do that? I tried putting a foreach inline in the aspx page, but I get the error Invalid expression term 'foreach'.

    Read the article

  • Triple Quotes? How do I delimit a databound Javascript string parameter in ASP.NET?

    - by David HAust
    How do I delimit a Javascript databound string parameter in an anchor OnClick event? I have an anchor tag in an ASP.NET Repeater control. The OnClick event of the anchor contains a call to a Javascript function. The Javascript funciton takes a string for it's input parameter. The string parameter is populated with a databound value from the Repeater. I need the 'double quotes' for the Container.DataItem. I need the 'single quotes' for the OnClick. And I still need one more delimiter (triple quotes?) for the input string parameter of the Javascript function call. Since I can't use 'single quotes' again, how do I ensure the Javascript function knows the input parameter is a string and not an integer? Without the extra quotes around the input string parameter, the Javascript function thinks I'm passing in an integer. Cheers in advance for any knowledge you can drop. The anchor: <a id="aShowHide" onclick='ToggleDisplay(<%# DataBinder.Eval(Container.DataItem, "JobCode") %>);' >Show/Hide</a> and here is the Javascript: <script language="JavaScript" type="text/javascript">/* Shows/Hides the Jobs Div */ function ToggleDisplay(jobCode) { /* Each div has it's ID set dynamically ('d' plus the JobCode) */ var elem = document.getElementById('d' + jobCode); if (elem) { if (elem.style.display != 'block') { elem.style.display = 'block'; elem.style.visibility = 'visible'; } else { elem.style.display = 'none'; elem.style.visibility = 'hidden'; } } }</script>

    Read the article

  • Add row to GridView after header row

    - by Jan-Frederik Carl
    I have a GridView with a header and some rows and want to add another row just below the header using jQuery. <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" ShowHeader="true" runat="server"> <Columns> <asp:TemplateField HeaderText="Activity Name"> <ItemTemplate> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:Button Text="Add Activity" runat="server" OnClientClick="addActivity(); return false;" /> </div> </form> My tries were $('#GridView1 tbody').prepend('<tr><td>new activity</td></tr>'); Puts a new row above the header $('#GridView1 table tr:first').after('<tr><td>new activity</td></tr>'); Does nothing (at least nothing visible, as well with any other tr element)

    Read the article

  • Adding <tr> from repeater's ItemDataBound Event

    - by nemiss
    My repeater's templates generate a table, where each item is a table row. When a very very specific condition is met (itemdata), I want to add an additional row to the table from this event. How can I do that? protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { bool tmp = bool.Parse(DataBinder.Eval(e.Item.DataItem, "somedata").ToString()); if (!tmp && e.Item.ItemIndex != 0) { //Add row after this item } } } I can use e.Item.Controls.Add() and add TableRow but for that I need to locate a table right? How can I solve that? UPDATE I will explain now why I need this: I am creating a sort of message board, where data entries are displayed in a tabled style. The first items in the table are "important" items after those items, i want to add this row. I could solved it using 2 repeaters, where the first repeater will be bounded to pinned items, and the second repeater will be bounded to refular items. But I don't want to have to repeaters nor I want to complex the business logic for separating the fetched data to pinned and not-pinned collection. I think the best opton is to do it "onfly", using one repeater and one datasource.

    Read the article

  • CSS call from code behind not working

    - by SmartestVEGA
    I have the following entries in the css file. a.intervalLinks { font-size:11px; font-weight:normal; color:#003399; text-decoration:underline; margin:0px 16px 0px 0px; } a.intervalLinks:link { text-decoration:underline; } a.intervalLinks:hover { text-decoration:none; } a.intervalLinks:visited { text-decoration:underline; } a.selectedIntervalLink { font-size:12px; font-weight:bold; color:#003399; text-decoration:none; margin:0px 16px 0px 0px; } a.intervalLinks:active { text-decoration:underline; font-size:large ; } Whenever i take the click on some links (not shown) which is embedded in the webpage ..i can see the change in the link a.intervalLinks:active { text-decoration:underline; font-size:large ; (the font of the link will become large) but after clicking the page refreshes ..the changes will go away i want to keep the change for ever in that link ...even there is a page refresh i understood that ..this can achieved only throughg the code behind of asp.net Following code should work:but unfortunately its not ..could anyone help? protected override void OnInit(EventArgs e) { rptDeptList.ItemDataBound += new RepeaterItemEventHandler(rptDeptList_ItemDataBound); } void rptDeptList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.DataItem == null) return; LinkButton btn = (LinkButton)e.Item.FindControl("LinkButton1"); btn.Attributes.Add("class", "intervalLinks"); } Current html code for links has been shown below : <ItemTemplate> <div class='dtilsDropListTxt'><div class='rightArrow' ></div> <asp:LinkButton ID="LinkButton1" runat="server" Text=<%#DataBinder.Eval(Container.DataItem, "WORK_AREA")%> CssClass="intervalLinks" OnClick="LinkButton1_Click" ></asp:LinkButton> </div> </ItemTemplate> Could anyone help?

    Read the article

  • ASP.NET Repeater - Evaluate Item as int?

    - by WedTM
    I'm trying to style a table row based upon a value in the databound collection (from LINQ to SQL) in my item template, however it's not working. This is what I have so far: <ItemTemplate> <% string style = String.Empty; if ((string)DataBinder.Eval(Quotes.Cu, "Status") == "Rejected") style = "color:red;"; else if ((string)Eval("Priority") == "Y") style = "color:green;"; if (style == String.Empty) Response.Write("<tr>"); else Response.Write("<tr style=\"" + style + "\""); %> <td> <%# Eval("QuoteID") %> </td> <td> <%# Eval("DateDue", "{0:dd/MM/yyyy}") %> </td> <td> <%# Eval("Company") %> </td> <td> <%# Eval("Estimator") %> </td> <td> <%# Eval("Attachments") %> </td> <td> <%# Eval("Employee") %> </td> </tr> </ItemTemplate>

    Read the article

  • Passing in extra parameters in a URL

    - by Scott Atkinson
    I have the below column on my table what gets binded on pageload, the parameters in there work fine but i need to add an additional parameter which is the fullname which is the next column along but im having trouble figuring our the syntax, here is my ASP <asp:TemplateField HeaderText="ID"> <ItemTemplate> <asp:HyperLink ID="hyperLeadID" runat="server" NavigateUrl='<%#Eval("ID","/documents/Q-Sheet.aspx?LeadID={0}&isHappyCallReferral=yes&isHappyName={1}") %>' Text='<%#Eval("ID")%>'></asp:HyperLink> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Referral Name"> <ItemTemplate> <asp:Label ID="lblRefName" CssClass="gvItem" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> As you can see at the end of ID column i have added isHappyName={1} which i assumed it would select the next column along as it starts at 0 but it keeps throwing an error which is "Index (zero based) must be greater than or equal to zero and less than the size of the argument list." Can someone help me to pass the usersname through the URL Thanks

    Read the article

  • ArgumentNullException when accessing a FormView instance

    - by David
    Background: I have an ASP.NET page which has a numebr of user controls within it. There are 2 user controls which are of interest. I need to display either one of them or neither of them, depending on the record selected previously. In the user controls I need to set properties of some controls which are in a FormView. So in my user control code-behind I have a number of properties which look something like this: Private ReadOnly Property phSectionReports() As PlaceHolder Get Return fvConfirmationReport.FindControl("phSectionReports") End Get End Property The problem: I am having problems with this Property. Sometimes it is returning Nothing/Null and sometimes it is throwing a NullArgumentException with the message "Value cannot be null. Parameter name: container". The exception is coming from trying to reference the fvConfirmationReport variable. fvConfirmationReport is the ID of my FormView in the page itself. So I am really after things to look for and if any ideas what sort of conditions (e.g stage in page cycle, etc.) might lead to this? An example stack trace is included below. ASP.NET 3.5 SP1, VB.NET Thanks, StackTrace: at System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) at System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) at System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at System.Web.UI.WebControls.GridView.DataBind() at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) ...snip... at System.Web.UI.Control.DataBind() at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.WebControls.FormView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) at System.Web.UI.WebControls.FormView.PerformDataBinding(IEnumerable data) at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at System.Web.UI.WebControls.FormView.DataBind() at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() at System.Web.UI.WebControls.FormView.EnsureDataBound() at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.FindControl(String id, Int32 pathOffset) at System.Web.UI.Control.FindControl(String id) at App_UserControls_xxx_ucConfirmationForm.get_phSectionReports() in ucConfirmationForm.ascx.vb:line 343 at App_UserControls_xxx_ucConfirmationForm.Page_Load(Object sender, EventArgs e) in ucConfirmationForm.ascx.vb:line 412 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() ...snip... at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Read the article

  • load complex class/nested xml file into dataset

    - by iTayb
    I want to create a dataset and bind it with a repeater. My datasource is a class, which is itself loaded from an nested xml file. I can use both as datasources. How can I do it? This is my sample XML file: <?xml version="1.0" encoding="utf-8"?> <BookStore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Book> <Name>??????? ????? 035006</Name> <Imageurl>math1.jpg</Imageurl> <Subject>???????</Subject> <Author>??? ????</Author> <Level>5</Level> <Year>2002</Year> <Rating>4</Rating> <BookSellers> <string>????? ?????</string> <string>?.?. ????? ??"?</string> <string>??? ?? ???? ????? ??????? ??"?</string> <string>?? ?????? ???? ?'????</string> <string>???? ??? ?????</string> <string>Garbage Collector</string> <string>???? ??????? ??????</string> </BookSellers> <BookPrices> <double>25</double> <double>48</double> <double>37</double> <double>52</double> <double>34</double> <double>22</double> <double>60</double> </BookPrices> </Book> </BookStore> Plus, how will I refer to this data? for example, DataBinder.Eval(Container.DataItem, "Imageurl" will bring me the url? Thank you very much!

    Read the article

  • System.MissingMemberException was unhandled by user code

    - by AmRoSH
    I'm using this code: Dim VehiclesTable1 = dsVehicleList.Tables(0) Dim VT1 = (From d In VehiclesTable1.AsEnumerable _ Select VehicleTypeName = d.Item("VehicleTypeName") _ , VTypeID = d.Item("VTypeID") _ , ImageURL = d.Item("ImageURL") _ , DailyRate = d.Item("DailyRate") _ , RateID = d.Item("RateID")).Distinct its linq to dataset and I Take Data on THis Rotator: <telerik:RadRotator ID="RadRotatorVehicleType" runat="server" Width="620px" Height="145" ItemWidth="155" ItemHeight="145" ScrollDirection="Left" FrameDuration="1" RotatorType="Buttons"> <ItemTemplate> <div style="text-align: center; cursor: pointer; width: 150px"> <asp:Image ID="ImageVehicleType" runat="server" Width="150" ImageUrl='<%# Container.DataItem("ImageURL") %>' /> <asp:Label ID="lblVehicleType" runat="server" Text='<%# Container.DataItem("VehicleTypeName") %>' Font-Bold="true"></asp:Label> <br /> <asp:Label ID="lblDailyRate" runat="server" Text='<%# Container.DataItem("DailyRate") %>' Visible="False"></asp:Label> <input id="HiddenVehicleTypeID" type="hidden" value='<%# Container.DataItem("VTypeID") %>' name="HiddenVehicleTypeID" runat="server" /> <input id="HiddenRateID" type="hidden" value='<%# Container.DataItem("RateID") %>' name="HiddenRateID" runat="server" /> </div> </ItemTemplate> <ControlButtons LeftButtonID="img_left" RightButtonID="img_right" /> </telerik:RadRotator> and I got this Exception: No default member found for type 'VB$AnonymousType_0(Of Object,Object,Object,Object,Object)'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.MissingMemberException: No default member found for type 'VB$AnonymousType_0(Of Object,Object,Object,Object,Object)'. I don't know whats up ? Any help please. Thanks for who tried to solve this but I got solution: using '<%# DataBinder.Eval(Container.DataItem,"ImageURL") %>' instead of '<%# Container.DataItem("RateID") %>' Thanks,

    Read the article

  • List of checkboxes

    - by Andrea Girardi
    Hi all, Happy New Year to all. I'm a newbie in VB.NET and ASP.NET. This is my problem: I retrieve a list of records from DB and, for every row, I need to show 4 checkboxes. I can use a checkboxlist for every rows, but it's not so clear how I can process the results after the submit. I've some object and some operations available for that object. From database I extract a list of object with all operations. For every operation I want to show a check box to enable or disable the operation. The result is something like that: OBJ1 - url - [] [x] [] OBJ2 - url - [] [x] [x] On url I've an href to another page created using the Id retrieved from DB. To create that I used this code: <td class="column-filename"> <strong> <asp:Label runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "GroupName")%>'></asp:Label> </strong> </td> <td align="left"> <span style="vertical-align:middle"> <asp:CheckBoxList runat="server" ID="operations" RepeatDirection="Horizontal" RepeatLayout="Table"> <asp:ListItem Text="View"></asp:ListItem> <asp:ListItem Text="Upload"></asp:ListItem> <asp:ListItem Text="Move"></asp:ListItem> <asp:ListItem Text="Delete"></asp:ListItem> <asp:ListItem Text="Rename"></asp:ListItem> <asp:ListItem Text="Replace"></asp:ListItem> </asp:CheckBoxList> </span> </td> </asp> </asp> my problem is: how can I parse all checkboxes? could you help me or send me a link or any other resources to solve my issue? many thanks! Andrea

    Read the article

  • ASP.NET Repeater Control Not Working in FireFox

    - by Robert Hyland
    everyone: I have an ASP.NET Application that uses a Repeater control to display a thumbnail gallery. When the user mouses over one of the thumbnails, the main image will present that thumbnail. It uses a Repeater control in a UserControl like this: <asp:Image ID="pictureImage" runat="server" Visible="true" Width="200px" /> <asp:Repeater ID="rpProductImages" runat="server" Visible="false"> <ItemTemplate> <div> <div style="float: left" id="smallImage" runat="server"> <div class="smallAltImage" onmouseover="showImage();" style="border: 1px solid #999999; margin: 5px 5px 5px 4px; width: 45px; height: 45px; background-position: center; background-repeat: no-repeat; background-image: url('<%#ResolveClientUrl(productImagesPath)%><%# String.Format("{0}", DataBinder.Eval(Container.DataItem, "ImageName")) %>');"> </div> <asp:Label ID="lblImageName" runat="server" Visible="false"><%# Eval("ImageName")%></asp:Label> </div> </div> </ItemTemplate> </asp:Repeater> Then, in a javascript file, this: function showImage(){ // Get thumbnail path. var img = (this.style.backgroundImage).substring(4, (this.style.backgroundImage).length - 1); $('#ctl00_ContentPlaceHolder1_ProductDetails1_pictureImage').attr('src', img); } It works fine in IE9, displaying the fully-qualified path for the image. In FireFox8, however, the img src looks like this: ""ProductImages/K42JY_500.jpg"" ... with two-sets of quotes! I think that the Repeater control is the central cause of the problem but I Googled and Googled again and could not find anyone that has experienced this similar situation! In fact, I'll PayPal anyone who can help me solve this with $50.00 (can't you tell I'm in the XMAS spirit, here?!) Any help is appreciated and "Thank You" in advance!

    Read the article

< Previous Page | 1 2 3 4  | Next Page >