Search Results

Search found 196 results on 8 pages for 'datafield'.

Page 7/8 | < Previous Page | 3 4 5 6 7 8  | Next Page >

  • Custom Paging for GridView in an UpdatePanel not firing PageIndexChanging event

    - by JeffCren
    I have a GridView that uses custom paging inside an UpdatePanel (so that the paging and sorting of the gridview don't cause postback). The sorting works fine, but the paging doesn't. The PageIndexChanging event is never called. This is the aspx code: <asp:UpdatePanel runat="server" ID="upSearchResults" ChildrenAsTriggers="true" UpdateMode="Always"> <ContentTemplate> <asp:GridView ID="gvSearchResults" runat="server" AllowSorting="true" AutoGenerateColumns="false" AllowPaging="true" PageSize="10" OnDataBound="gvSearchResults_DataBound" OnRowDataBound ="gvSearchResults_RowDataBound" OnSorting="gvSearchResults_Sorting" OnPageIndexChanging="gvSearchResults_PageIndexChanging" Width="100%" EnableSortingAndPagingCallbacks="false"> <Columns> <asp:TemplateField HeaderText="Select" HeaderStyle-HorizontalAlign="Center"> <ItemTemplate> <asp:HyperLink ID="lnkAdd" runat="server">Add</asp:HyperLink> <asp:HiddenField ID="hfPersonId" runat="server" Value='<%# Eval("Id") %>'/> </ItemTemplate> </asp:TemplateField> <asp:BoundField HeaderText="First Name" DataField="FirstName" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" SortExpression="FirstName" /> <asp:BoundField HeaderText="Last Name" DataField="LastName" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" SortExpression="LastName" /> <asp:TemplateField HeaderText="Phone Number" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" > <ItemTemplate> <asp:Label ID="lblPhone" runat="server" Text="" /> </ItemTemplate> </asp:TemplateField> </Columns> <PagerTemplate> <table width="100%" class="pager"> <tr> <td> </td> </tr> </table> </PagerTemplate> </asp:GridView> <div class="btnContainer"> <div class="btn btn-height_small btn-style_dominant"> <asp:LinkButton ID="lbtNewRecord" runat="server" OnClick="lbtNewRecord_Click"><span>Create New Record</span></asp:LinkButton> </div> <div class="btn btn-height_small btn-style_subtle"> <a onclick="openParticipantModal();"><span>Cancel</span></a> </div> </div> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="gvSearchResults" EventName="PageIndexChanging" /> <asp:AsyncPostBackTrigger ControlID="gvSearchResults" EventName="Sorting" /> </Triggers> </asp:UpdatePanel> In the code behind I have a SetPaging method that is called on the GridView OnDataBound event: private void SetPaging(GridView gv) { GridViewRow row = gv.BottomPagerRow; var place = row.Cells[0]; var first = new LinkButton(); first.CommandName = "Page"; first.CommandArgument = "First"; first.Text = "First"; first.ToolTip = "First Page"; if (place != null) place.Controls.Add(first); var lbl = new Label(); lbl.Text = " "; if (place != null) place.Controls.Add(lbl); var prev = new LinkButton(); prev.CommandName = "Page"; prev.CommandArgument = "Prev"; prev.Text = "Prev"; prev.ToolTip = "Previous Page"; if (place != null) place.Controls.Add(prev); var lbl2 = new Label(); lbl2.Text = " "; if (place != null) place.Controls.Add(lbl2); for (int i = 1; i <= gv.PageCount; i++) { var btn = new LinkButton(); btn.CommandName = "Page"; btn.CommandArgument = i.ToString(); if (i == gv.PageIndex + 1) { btn.BackColor = Color.Gray; } btn.Text = i.ToString(); btn.ToolTip = "Page " + i.ToString(); if (place != null) place.Controls.Add(btn); var lbl3 = new Label(); lbl3.Text = " "; if (place != null) place.Controls.Add(lbl3); } var next = new LinkButton(); next.CommandName = "Page"; next.CommandArgument = "Next"; next.Text = "Next"; next.ToolTip = "Next Page"; if (place != null) place.Controls.Add(next); var lbl4 = new Label(); lbl4.Text = " "; if (place != null) place.Controls.Add(lbl4); var last = new LinkButton(); last.CommandName = "Page"; last.CommandArgument = "Last"; last.Text = "Last"; last.ToolTip = "Last Page"; if (place != null) place.Controls.Add(last); var lbl5 = new Label(); lbl5.Text = " "; if (place != null) place.Controls.Add(lbl5); } The paging works if I don't use custom paging, but I really need to use the custom paging. I can't figure out why the PageIndexChanging event isn't fired when I'm using the custom paging. Thanks, Jeff

    Read the article

  • how to dinamically add controls in asp.net Dynamic Data

    - by loviji
    Hello, i'm trying to work with asp.NET Dynamic Data. So, I see Dynamic Data not well learned by people as other technologies. now, to my question. Lets us work with Details.aspx page that located on ~\DynamicData\PageTemplates I need to add <asp:DynamicControl runat="server" to page into Form1.detailsTable. i've tried like this: protected DynamicControl myC=new DynamicControl(); protected void Page_Load(object sender, EventArgs e) { foreach(var c in table.Columns) { myC.DataField=c.DisplayName; FormView1.Controls.Add(myC); } } but I can not see the desired result. where is the problem. thanks

    Read the article

  • SPGridView current item in Sharepoint

    - by pistacchio
    Hi, I'm making a custom webpart. I takes some items from a list and display them with a SPGridView. I bound the fields like this: // Grab data from a SP List into dvwTickets SPGridView grdMyTickets = new SPGridView(); grdMyTickets.DataSource = dvwTickets; [..] BoundField colTicketTypology = new BoundField(); colTicketTypology.DataField = "ID"; colTicketTypology.HeaderText = ticketList.Fields.GetFieldByInternalName("ID").Title; grdMyTickets.Columns.Add(colTicketTypology); [..] This works. Now, what a grid does behind the scene when binding data to it is cycling through the binded data. How can I access the "Current Item" to make operations on each item while binding? Thanks

    Read the article

  • SP Gridview link button column not working

    - by Dilse Naaz
    Hi I have one sharepoint custom page application which is rendering from a user control. In the user control page, i had used SPGridview for displaying data. My first column is Title Column (link button column), when the user click on the link, then one popup window will open with corresponding data. But the problem is the link button is not working properly. But this application is working as fine in asp.net application. My code is shown below.. <asp:UpdatePanel runat="server" ID="UpdatePanel2"> <ContentTemplate> <SharePoint:SPGridView ID="dgApplicationBox" CellPadding="0" Height="100%" runat="server" ForeColor="Black" Font-Size="10px" Font-Names="Verdana" AutoGenerateColumns="False" AllowPaging="True" Width="100%" BorderStyle="None" BorderWidth="0px" PageSize="10" BorderColor="White" BackColor="White" OnRowDataBound="dgApplicationBox_RowDataBound" DataKeyNames="ApplicationID" OnSelectedIndexChanged="dgApplicationBox_SelectedIndexChanged" OnPageIndexChanging="dgApplicationBox_PageIndexChanging" CssClass="ms-listviewtable" AlternatingRowStyle-CssClass="ms-alternating"> <SelectedRowStyle Font-Bold="True" ForeColor="Black" BackColor="#CE5D5A"></SelectedRowStyle> <EditRowStyle Font-Size="10px" Font-Names="Verdana,Arial,Helvetica,sans-serif"></EditRowStyle> <HeaderStyle Font-Size="11px" Height="20px" Font-Bold="True" ForeColor="Black" BackColor="#E7E8EC"> </HeaderStyle> <PagerStyle HorizontalAlign="Center" ForeColor="#414E61" Font-Size="5px" Font-Names="arial" Height="10px" BackColor="#EBF3FF"></PagerStyle> <RowStyle /> <Columns> <asp:TemplateField HeaderText="Title" HeaderStyle-CssClass="ms-vb"> <ItemTemplate> <asp:LinkButton ID="lbtnSubject" Text='<%# Bind("UDF5") %>' runat="server" OnClick="lbtnSubject_Click"></asp:LinkButton> </ItemTemplate> <HeaderStyle HorizontalAlign="Left" CssClass="ms-vh2" Font-Bold="true" /> <ItemStyle HorizontalAlign="Left" CssClass="ms-vb2" /> </asp:TemplateField> <asp:TemplateField HeaderText="Request No."> <ItemTemplate> <asp:Label ID="lblReqNo" Text='<%# Bind("UDF1") %>' runat="server" /> </ItemTemplate> <HeaderStyle HorizontalAlign="Left" CssClass="ms-vh2" Font-Bold="true" /> <ItemStyle HorizontalAlign="Left" CssClass="ms-vb2" /> </asp:TemplateField> <asp:BoundField DataField="CreatedOn" HeaderText="Created On" DataFormatString="{0:MM/dd/yyyy}" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"> <HeaderStyle CssClass="ms-vh2" Font-Bold="true"></HeaderStyle> <ItemStyle CssClass="ms-vb2"></ItemStyle> </asp:BoundField> <asp:BoundField DataField="Name" HeaderText="Form Type" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"> <HeaderStyle CssClass="ms-vh2" Font-Bold="true"></HeaderStyle> <ItemStyle CssClass="ms-vb2"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="History"> <HeaderStyle CssClass="ms-vh2" Font-Bold="true"></HeaderStyle> <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="21px" CssClass="ms-vb2"> </ItemStyle> <ItemTemplate> <asp:LinkButton ID="lbtnView" runat="server" OnClick="lbtnView_Click" >View</asp:LinkButton> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Application Id" Visible="False"> <ItemTemplate> <asp:Label ID="lblApplicationId" runat="server" Text='<%# Bind("ApplicationId") %>'></asp:Label> </ItemTemplate> <HeaderStyle HorizontalAlign="Left" CssClass="ms-vh2" Font-Bold="true" /> <ItemStyle HorizontalAlign="Left" CssClass="ms-vb2" /> </asp:TemplateField> </Columns> </SharePoint:SPGridView> </ContentTemplate> </asp:UpdatePanel> when the user click on the link button, this code will works.. try { clearSession(); Session["DigitalSignature"] = null; Button btnDetails = sender as Button; DataTable dt = (DataTable)dgApplicationBox.DataSource; GridViewRow gvRow = (GridViewRow)(sender as LinkButton).Parent.Parent; Session["AppId"] = ((Label)gvRow.FindControl("lblApplicationId")).Text; string subject = ((LinkButton)gvRow.FindControl("lbtnSubject")).Text; WFInfo objWFInfo = new WFInfo(); objWFInfo.InitWorkflowProperty(Convert.ToInt32(Session["AppId"].ToString()), Session["CurrentUser"].ToString()); Session["FormId"] = objWFInfo.FormID.ToString(); string strFilname = objWFInfo.GetFormName(objWFInfo.ApplicationCategoryID.ToString()); string WindowName = strFilname; strFilname += ".aspx"; Session["CategoryId"] = objWFInfo.ApplicationCategoryID.ToString(); //pnlSubmitModal_ModalPopupExtender.Show(); ScriptManager.RegisterStartupScript(this, this.GetType(), "starScript", "popUpWindow('" + strFilname + "?tittle=" + subject + "', 800, 690,'" + WindowName + "');", true); this.Controls.Add(new LiteralControl("<script>alert('hi');</script>")); if (Session["CurrentUser"] != null) { ApplicationForm objApplication = new ApplicationForm(); objApplication.markRead(Convert.ToInt32(Session["AppId"].ToString()), Session["CurrentUser"].ToString()); } bindFolderData(); } If i click on the link button, there will be only post back occuring. but not the popup window open.. Please help me for resolving this problem. thanks in advance..

    Read the article

  • Conditions on the DetailsView

    - by jpabluz
    What is the best way of implementing conditions (requiring fields based in other fields) in a DetailsView? I have this: protected override ICollection CreateFieldSet(object dataItem, bool useDataSource) { var country = new BoundField(); country.DataField = "Country"; country.ReadOnly = ViewState["DifferentAddress"] != null; } I set the ViewState["DifferentAddress"] later, but since the change happens after the controls are created I lost the current state and get the old state. Which is the desired way of doing this? I am in the right path - or should I use another class to do this?

    Read the article

  • C# Gridview - Checking if a column already exists when adding a new column fails

    - by Nir
    I have a GridView with 10 columns. On a certain condition, I want to add a new column called "Expiration Date". The problem is that when the user presses "Search" again (Postback) the column is added again. I check before adding the column, to see if it already exists: BoundField dtExp = new BoundField {DataField = "DateTimeExpired", HeaderText = "Expiration Date", DataFormatString = "{0:d}"}; if (!grid.Columns.Contains(dtExp)){grid.Columns.Add(dtExp);} But the problem is that even if the column already exists, "Contains" returns false. What am I doing wrong? Thanks!

    Read the article

  • How to dynamically add controls in asp.net Dynamic Data

    - by loviji
    Hello, i'm trying to work with asp.NET Dynamic Data. So, I see asp.NET Dynamic Data not well learned by people as other technologies. now, to my question. Lets us work with Details.aspx page that located on ~\DynamicData\PageTemplates I need to add <asp:DynamicControl runat="server" to page into Form1.detailsTable. i've tried like this: protected DynamicControl myC=new DynamicControl(); protected void Page_Load(object sender, EventArgs e) { foreach(var c in table.Columns) { myC.DataField=c.DisplayName; FormView1.Controls.Add(myC); } } but I can not see the desired result. where is the problem. thanks

    Read the article

  • How do I add a combo box to a DataGrid?

    - by FigBug
    I want to add a ComboBox to a DataGrid. So far, the only way I've found to do it is like this: <mx:DataGridColumn headerText="Header" dataField="src" > <mx:itemRenderer> <mx:Component> <mx:ComboBox dataProvider="{data.srcChoices}" /> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> The problem is the initial value of the ComboBox isn't set correctly. If I hard code the choices, then the initial value is set correctly. I can't hard code the choices. Any idea what I should do?

    Read the article

  • How to localize HeaderText in GridView or validation controls?

    - by Janusz
    I cannot figure out why HeaderText or validation controls always fallback to default culture - even though rest of the controls are in correct culture. I have a gridView with HeaderText specified in this way <asp:BoundField DataField="totalSales" HeaderText="<%$ Resources:Strings,TotalSales %>" /> In the same way I have validation controls and they can't be localized. Only this syntax does work <%= Resources.Strings.Payments %> I set different culture in Master page using this statement in Page_Init Me.Page.Culture = "pl-PL" Me.Page.UICulture = "pl-PL" Can anyone spot what's wrong? I have been Googling it for last few days without success. Thanks!

    Read the article

  • DataFormatString in my Gridview does not work in SharePoint

    - by Etienne
    I have a ASP.NET GridView that i created on a page through SharePoint Designer 2007. For some reason it just does not want to work, why is that and how can i Fix it? Funny thing, it worked on another SharePoint Server but not on the one i am working on now, so i know my code is fine, it must be something ells on the SharePoint Server maybe? My Currency DataFormatStrings also dont want to work on my current SharePoint Server. My DataFormatString for my Date field <asp:BoundField DataField="c505_remdate" HeaderText="Remit. Advice Date" SortExpression="c505_remdate" DataFormatString="{0:d/MM/yyyy}" /> Thanks in advanced!!

    Read the article

  • Binding Generic List Array to GridView

    - by OliverS
    Hi I have a List which returns an array of "Question". My question is how can I bind this to a grid view? When I try to call Question.Ordinal I get that it does not exist in the data source. I am using the following code: GridView1.DataSource = myList.GetQ(); GrdiView1.DataBind(); myList.GetQ() returns a List which is an array of "Question". When I set the column DataField to "!" I get the object Question. My question is how can I get the objects property? I tried "!.Ordinal" does not work. I was reading this post for reference, here, any help is greatly appreciated, thanks.

    Read the article

  • Get a value of checked checkbox into a button from a Gridview

    - by Nimish Kulkarni
    I have a Gridview Generated as follows : <asp:GridView ID="Cash_GridView" runat="server" CssClass="Grid" > <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="MemberCheck" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Loan_Acno" HeaderText="Loan A/C number" /> </Columns> </asp:Gridview> <asp:Button ID="CashPayButton" runat="server" Text="Pay Dividend" CssClass="bluesome" OnClick="CashPayButton_Click" /> And also having the above button click event now when i click checkbox on particular row i want that whole row to be get caluclated in the Button click event in the code behind protected void CashPayButton_Click(object sender, EventArgs e) { }

    Read the article

  • ASP.NET GridView issue with DataFormatString in a BoundField

    - by David
    I have a BoundField in a GridView whose datatype (in MSSQL) is time(7). The format is being displayed as: hh:mm:ss.xxxxxx I want to add a DataFormatString to this boundfield so that the field displays in the format: hh:mm:ss Here is a snippet of the .aspx file that I'm modifying: <asp:BoundField DataField="ProcTime" HeaderText="ProcTime" SortExpression="ProcTime" ApplyFormatInEditMode="true" HtmlEncode="true" DataFormatString="{0:F0}" /> I've tried many different format strings (t, T, d, D, m, etc) but it does not change the format of the boundfield. What am I missing?

    Read the article

  • How can i show delete image in each row in a Data grid ?

    - by developer
    i want show a image onmouse over inside data grid to each row,so if i click on that image,some function should call(as per my requirement). how can i do this ? <mx:DataGrid width="320" height="624" verticalScrollPolicy="on" dataProvider="{blocked_Usernames}" editable="true"> <mx:columns> <mx:DataGridColumn headerText="Blocked User Name" dataField="blockedUsernames" editorDataField="value"/> <mx:DataGridColumn width="20" editable="false"> <mx:itemRenderer > <mx:Component > <mx:Image source="@Embed('assets/image/Close.png')" width="10" height="10" autoLoad="false"/> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> </mx:columns> </mx:DataGrid>

    Read the article

  • Does Microsoft hate firefox? ASP.Net gridview performance in firefox bug?

    - by Maxim Gershkovich
    Could someone please explain the significant difference in speed between a firefox updatepanel async postback and one performed in IE? Average Firefox Postback Time For 500 objects: 1.183 Second Average IE Postback Time For 500 objects: 0.295 Seconds Using firebug I can see that the majority of this time in FireFox is spent on the server side. A total of 1.04 seconds. Given this fact the only thing I can assume is causing this problem is the way that ASP.Net renders its controls between the two browsers. Has anyone run into this problem before? VB.Net Code Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click GridView1.DataBind() End Sub Public Function GetStockList() As StockList Dim res As New StockList For l = 0 To 500 Dim x As New Stock With {.Description = "test", .ID = Guid.NewGuid} res.Add(x) Next Return res End Function Public Class Stock Private m_ID As Guid Private m_Description As String Public Sub New() End Sub Public Property ID() As Guid Get Return Me.m_ID End Get Set(ByVal value As Guid) Me.m_ID = value End Set End Property Public Property Description() As String Get Return Me.m_Description End Get Set(ByVal value As String) Me.m_Description = value End Set End Property End Class Public Class StockList Inherits List(Of Stock) End Class Markup <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <script type="text/javascript" language="Javascript"> function timestamp_class(this_current_time, this_start_time, this_end_time, this_time_difference) { this.this_current_time = this_current_time; this.this_start_time = this_start_time; this.this_end_time = this_end_time; this.this_time_difference = this_time_difference; this.GetCurrentTime = GetCurrentTime; this.StartTiming = StartTiming; this.EndTiming = EndTiming; } //Get current time from date timestamp function GetCurrentTime() { var my_current_timestamp; my_current_timestamp = new Date(); //stamp current date & time return my_current_timestamp.getTime(); } //Stamp current time as start time and reset display textbox function StartTiming() { this.this_start_time = GetCurrentTime(); //stamp current time } //Stamp current time as stop time, compute elapsed time difference and display in textbox function EndTiming() { this.this_end_time = GetCurrentTime(); //stamp current time this.this_time_difference = (this.this_end_time - this.this_start_time) / 1000; //compute elapsed time return this.this_time_difference; } //--> </script> <script type="text/javascript" language="javascript"> var time_object = new timestamp_class(0, 0, 0, 0); //create new time object and initialize it Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function BeginRequestHandler(sender, args) { var elem = args.get_postBackElement(); ActivateAlertDiv('visible', 'divAsyncRequestTimer', elem.value + ''); time_object.StartTiming(); } function EndRequestHandler(sender, args) { ActivateAlertDiv('visible', 'divAsyncRequestTimer', '(' + time_object.EndTiming() + ' Seconds)'); } function ActivateAlertDiv(visstring, elem, msg) { var adiv = $get(elem); adiv.style.visibility = visstring; adiv.innerHTML = msg; } </script> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="click" /> </Triggers> <ContentTemplate> <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"> </asp:UpdateProgress> <asp:Button ID="Button1" runat="server" Text="Button" /> <div id="divAsyncRequestTimer" style="font-size:small;"> </div> <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" AutoGenerateColumns="False"> <Columns> <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" /> <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" /> </Columns> </asp:GridView> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetStockList" TypeName="WebApplication1._Default"> </asp:ObjectDataSource> </ContentTemplate> </asp:UpdatePanel> </form>

    Read the article

  • Using 'DataKeyNames' on an ASP.NET GridView control, causes exception on DataBind() call

    - by azam
    Hi I have an ASP.NET 3.5 WebForms application. Using a GridView control and the DataKeyNames attribute <asp:GridView ID="data" runat="server" DataKeyNames="ID"> <Columns> <asp:BoundField DataField="ID" /> <!-- this binds --> If I take out the DataKeyNames="ID" it binds the data. I would really like to try and use DataKeyNames so I don't need to have the ID column in the columns list. Error: DataBinding: 'Nmspace.MyClass' does not contain a property with the name '"ID"'. Please help.

    Read the article

  • Shouldn’t GridView’s RowStyle-HorizontalAlign property overwrite CSS’s text-align property?

    - by AspOnMyNet
    a) As far as I know, GridView’s RowStyle-HorizontalAlign property should overwrite CSS’s text-align property, and thus text inside GridView's cells should be located on the left side of the cells, but is instead moved to the right side. Why is that? b) Similarly, RowStyle-Font-Bold should overwrite CSS’s font-weight property and thus fonts shouldn’t be in bold. But again, CSS’s property overwrites RowStyle’s Font-Bold property. Why? <div id="someClass"> <asp:GridView ID="gvwShowUsers" runat="server" > <RowStyle BackColor="#FFFBD6" ForeColor="#333333" Font-Bold="false" HorizontalAlign="Left" /> <Columns> <asp:BoundField DataField="UserName" HeaderText="UserName" /> </Columns> </asp:GridView> </div> CSS file: #someClass td { font-weight:bolder; text-align:right; } thanx

    Read the article

  • How to display a date time in 16 Nov 2011 15:12 format

    - by Mark
    I have a grid view column in which I give the datefomat as dd MMM yyyy HH:mm and in code behind databound I change the time, the same time in database is not shown in the gridview, because of that the date is not displayed in 16 Nov 2011 15:12 format, it is displayed in 16/11/2011 15:12 format, how can i display it in 16 Nov 2011 15:12 format asp <asp:BoundField DataField="SendDate" ItemStyle-Width="15%" HeaderText="Sent At" DataFormatString="{0:dd MMM yyyy HH:mm}" SortExpression="SendDate" /> c# double timeDifference = Convert.ToDouble(Session["utimezone"].ToString()); e.Row.Cells[5].Text = Convert.ToString(senddate.AddMinutes(timeDifference * 60));

    Read the article

  • Extracting the Date from a DateTime in Entity Framework 4 and LINQ

    - by Ken Cox [MVP]
    In my current ASP.NET 4 project, I’m displaying dates in a GridDateTimeColumn of Telerik’s ASP.NET Radgrid control. I don’t care about the time stuff, so my DataFormatString shows only the date bits: <telerik:GridDateTimeColumn FilterControlWidth="100px"   DataField="DateCreated" HeaderText="Created"    SortExpression="DateCreated" ReadOnly="True"    UniqueName="DateCreated" PickerType="DatePicker"    DataFormatString="{0:dd MMM yy}"> My problem was that I couldn’t get the built-in column filtering (it uses Telerik’s DatePicker control) to behave.  The DatePicker assumes that the time is 00:00:00 but the data would have times like 09:22:21. So, when you select a date and apply the EqualTo filter, you get no results. You would get results if all the time portions were 00:00:00. In essence, I wanted my Entity Framework query to give the DatePicker what it wanted… a Date without the Time portion. Fortunately, EF4 provides the TruncateTime  function. After you include Imports System.Data.Objects.EntityFunctions You’ll find that your EF queries will accept the TruncateTime function. Here’s my routine: Protected Sub RadGrid1_NeedDataSource _     (ByVal source As Object, _      ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) _     Handles RadGrid1.NeedDataSource     Dim ent As New OfficeBookDBEntities1     Dim TopBOMs = From t In ent.TopBom, i In ent.Items _                   Where t.BusActivityID = busActivityID _       And i.BusActivityID And t.ItemID = i.RecordID _       Order By t.DateUpdated Descending _       Select New With {.TopBomID = t.TopBomID, .ItemID = t.ItemID, _                        .PartNumber = i.PartNumber, _                        .Description = i.Description, .Notes = t.Notes, _                        .DateCreated = TruncateTime(t.DateCreated), _                        .DateUpdated = TruncateTime(t.DateUpdated)}     RadGrid1.DataSource = TopBOMs End Sub Now when I select March 14, 2011 on the DatePicker, the filter doesn’t stumble on time values that don’t make sense. Full Disclosure: Telerik gives me (and other developer MVPs) free copies of their suite.

    Read the article

  • Flex DataGrid with ComboBox itemRenderer

    - by Jamie Love
    Hi there, I'm going spare trying to figure out the "correct" way to embed a ComboBox inside a Flex (3.4) DataGrid. By Rights (e.g. according to this page http://blog.flexmonkeypatches.com/2008/02/18/simple-datagrid-combobox-as-item-editor-example/) it should be easy, but I can't for the life of me make this work. The difference I have to the example linked above is that my display value (what the user sees) is different to the id value I want to select on and store in my data provider. So what I have is: <mx:DataGridColumn headerText="Type" width="200" dataField="TransactionTypeID" editorDataField="value" textAlign="center" editable="true" rendererIsEditor="true"> <mx:itemRenderer> <mx:Component> <mx:ComboBox dataProvider="{parentDocument.transactionTypesData}"/> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> Where transactionTypesData has both 'data' and 'label' fields (as per what the ComboBox - why on earth it doesn't provide both a labelField and idField I'll never know). Anyway, the above MXML code doesn't work in two ways: The combo box does not show up with any selected item. After selecting an item, it does not store back that selected item to the datastore. So, has anyone got a similar situation working?

    Read the article

  • ASP.Net: Adding client side onClick to a HyperlinkField in GridView

    - by Nir
    I have an existing GridView which contains the field "partner name". It is sortable by partner name. Now I need to change the Partner Name field and in some condition make it clickable and alert() something. The existing code is: <asp:GridView ID="gridViewAdjustments" runat="server" AutoGenerateColumns="false" AllowSorting="True" OnSorting="gridView_Sorting" OnRowDataBound="OnRowDataBoundAdjustments" EnableViewState="true"> <asp:BoundField DataField="PartnerName" HeaderText="Name" SortExpression="PartnerName"/> I've added the column: <asp:hyperlinkfield datatextfield="PartnerName" SortExpression="PartnerName" headertext="Name" ItemStyle-CssClass="text2"/> which enables me to control the CSS and sort. However, I can't find how to add a client side javascript function to it. I found that adding : <asp:TemplateField HeaderText="Edit"> <ItemTemplate> <a id="lnk" runat="server">Edit</a> enable me to access "lnk" by id and add to its attributes. However, I lose the Sort ability. What's the correct solution in this case? Thanks.

    Read the article

  • Gridview buttonfield works LinkButton doesn't

    - by Karsten
    I've been fighting this problem for many hours now and could really use some help :-) This is the grid <asp:GridView ID="annonceView" runat="server" AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="dataSourceAnnoncer"> <Columns> <asp:BoundField DataField="Productname" HeaderText="Productname" /> <asp:buttonfield buttontype="Link" commandname="Delete" text="Delete"/> <asp:TemplateField HeaderText="Administration"> <ItemTemplate> <asp:LinkButton ID="lnkBtnDelete" runat="server" Text="Delete" CausesValidation="False" CommandName="Delete" OnClientClick="return confirm('Delete?')" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:LinqDataSource ID="dataSourceAnnoncer" runat="server" ContextTypeName="Namespcae.TheContext" EnableDelete="True" TableName="Annoncer"> </asp:LinqDataSource> Clicking the buttonfield deletes the record just fine. Clicking the LinkButton doesn't work. I get a postback and the grid is shown as empty and no record is deleted. Seems like an empty databinding. I have tried to create a custom OnClick, OnCommand event for the LinkButton, but neither are fired. The OnRowCommand isn't fired either. I don't manually DataBind in the codebehind.

    Read the article

  • Gridview and Modal popup not updating

    - by rs
    I have page with following controls <asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <uc2:CountryControl ID="Country1" runat="server" /> <br class = "br_e" /> <br class = "br_e" /> <asp:UpdatePanel ID="upCountry2" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Panel runat="server" ID="pnCountry" Width="400px" Visible="false"> <asp:GridView ID="gvCountry" runat="server" AllowSorting="true" DataKeyNames="countryid" DataSourceID="data_country1" AutoGenerateColumns="false"> <Columns> <asp:CommandField ButtonType="Link" ShowDeleteButton="true" /> <asp:BoundField HeaderText="Country" DataField="CountryName" SortExpression="CountryName" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="data_country1" runat="server" ConnectionString="<%$ zyx %>" SelectCommand="xyz" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:SessionParameter Name="country" DefaultValue="" ConvertEmptyStringToNull="true" SessionField="CountryID" Type="String" /> </SelectParameters> </asp:SqlDataSource> </asp:Panel> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> My user control is a modal popup to select country and add selected ids to a session variable. And in main page bind data using ids in session variable.Gridview - on deleting event i'm deleting that id from session and on deleted event updating both user control using a refresh method (Country1.Refresh()) and gridview panel. But updatepanel is not getting updated and even modalpopup is also not getting refreshed. What could be wrong here? Even though update and refresh events are fired and executed, why is page not getting updated?

    Read the article

  • How can I make an AdvancedDataGrid re-display its labels when the results of the labelFunction chang

    - by Chris R
    I have an AdvancedDataGrid with a custom label function whose value can change based on other form status (specifically, there's a drop down to choose the time display format for some columns). Right now, I have this labelFunction: internal function formatColumnTime(item: Object, column: AdvancedDataGridColumn): String { var seconds: Number = item[column.dataField]; return timeFormat.selectedItem.labelFunction(seconds); } internal function formatTimeAsInterval(time: Number): String { if (isNaN(time)) return ""; var integerTime: int = Math.round(time); var seconds: int = integerTime % 60; integerTime = integerTime / 60; var minutes: int = integerTime % 60; var hours: int = integerTime / 60; return printf("%02d:%02d:%02d", hours, minutes, seconds); } internal function formatTimeAsFractions(time: Number): String { if (isNaN(time)) return ""; var hours: Number = time / 3600.0; return new String(Math.round(hours * 100) / 100); } ... and the timeFormat object is a combo box with items whose labelFunction attributes are formatTimeAsFractions and formatTimeAsInterval. The columns that have time formats have formatColumnTime as their labelFunction value, because extracting the seconds in that function and passing it in to the formatters made for a more testable app (IMHO). So, when the timeFormat.selectedItem value changes, I want to force my grid to re-calculate the labels of these colums. What method must I call on it? invalidateProperties() didn't work, so that's out.

    Read the article

  • Moving to .net 4 results in System.Transactions Critical: 0

    - by john
    Hi I have fully working project in .net 3.5SP1, with EF 1 ORM. I tried to upgrade to .net 4. No issue while upgrading... Then i ran the project and got a NullExecptionError, with no stack trace... and no way to debug. Looking at the output windows i can read this: System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>OTCSouscriptions.vshost.exe</AppDomain><Exception><ExceptionType>System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Object reference not set to an instance of an object.</Message><StackTrace> at System.Windows.StyleHelper.GetInstanceValue(UncommonField`1 dataField, DependencyObject container, FrameworkElement feChild, FrameworkContentElement fceChild, Int32 childIndex, DependencyProperty dp, Int32 i, EffectiveValueEntry&amp;amp; entry) at System.Windows.FrameworkTemplate.ReceivePropertySet(Object targetObject, XamlMember member, Object value, DependencyObject templatedParent) at System.Windows.FrameworkTemplate.&amp;lt;&amp;gt;c__DisplayClass6.&amp;lt;LoadOptimizedTemplateContent&amp;gt;b__4(Object sender, XamlSetValueEventArgs setArgs) at System.Xaml.XamlObjectWriter.OnSetValue(Object eventSender, XamlMember member, Object value) at System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent) at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx) at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx) at System.Xaml.XamlObjectWriter.WriteEndObject() at System.Xaml.XamlWriter.WriteNode(XamlReader reader) at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter) Any help appreciated... Thanks John

    Read the article

< Previous Page | 3 4 5 6 7 8  | Next Page >