Search Results

Search found 1403 results on 57 pages for 'yui datatable'.

Page 39/57 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • How to bind grid in ASP.NET?

    - by Abid Ali
    I cant bind my Grid. I dont know what I am doing wrong, the grid appears empty when I run the program. here is my code :: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) this.BindGrid(this.GridView1); } private void BindGrid(GridView grid) { SqlCommand cmd = new SqlCommand("Select * from Person", cn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); grid.DataSource = dt; grid.DataBind(); } <body> <form id="form1" runat="server"> <div style="margin-left: 240px"> <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" Width="856px" AutoGenerateColumns = "false" ShowFooter = "true" ShowHeader="true" BorderStyle="Groove" CaptionAlign="Top" HorizontalAlign="Center" onrowdatabound="GridView1_RowDataBound" > <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <Columns> <asp:BoundField HeaderText="ID" /> <asp:BoundField HeaderText="First Name" /> <asp:BoundField HeaderText="Last Name" /> <asp:BoundField HeaderText="Home Phone #" /> <asp:BoundField HeaderText="Cell #" /> <asp:BoundField HeaderText="Email Address" /> <asp:BoundField HeaderText="NIC #" /> <asp:TemplateField HeaderText="Action"> <ItemTemplate> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:Button ID="Button2" runat="server" Text="Button" /> </ItemTemplate> </asp:TemplateField> </Columns> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#999999" /> <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> </asp:GridView> </div> </form> </body>

    Read the article

  • GridView in ASP.NET 2.0

    - by Subho
    How can I populate an editable Grid with data from different tables from MSSQL Server'05 writing a code behind function??? I have used: Dim conn As New SqlConnection(conn_web) Dim objCmd As New SqlDataAdapter(sql, conn) Dim oDS As New DataSet objCmd.Fill(oDS, "TAB") Dim dt As DataTable = oDS.Tables(0) Dim rowCount As Integer = dt.Rows.Count Dim dr As DataRow = dt.NewRow() If rowCount = 0 Then e.DataSource = Nothing e.DataBind() e.Focus() Else e.DataSource = dt e.DataBind() End If

    Read the article

  • Alert on gridview edit based on permission

    - by Vicky
    I have a gridview with edit option at the start of the row. Also I maintain a seperate table called Permission where I maintain user permissions. I have three different types of permissions like Admin, Leads, Programmers. These all three will have access to the gridview. Except admin if anyone tries to edit the gridview on clicking the edit option, I need to give an alert like This row has important validation and make sure you make proper changes. When I edit, the action with happen on table called Application. The table has a column called Comments. Also the alert should happen only when they try to edit rows where the Comments column have these values in them. ManLog datas Funding Approved Exported Applications My try so far. public bool IsApplicationUser(string userName) { return CheckUser(userName); } public static bool CheckUser(string userName) { string CS = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); DataTable dt = new DataTable(); using (SqlConnection connection = new SqlConnection(CS)) { SqlCommand command = new SqlCommand(); command.Connection = connection; string strquery = "select * from Permissions where AppCode='Nest' and UserID = '" + userName + "'"; SqlCommand cmd = new SqlCommand(strquery, connection); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); } if (dt.Rows.Count >= 1) return true; else return true; } protected void Details_RowCommand(object sender, GridViewCommandEventArgs e) { string currentUser = HttpContext.Current.Request.LogonUserIdentity.Name; string str = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); string[] words = currentUser.Split('\\'); currentUser = words[1]; bool appuser = IsApplicationUser(currentUser); if (appuser) { DataSet ds = new DataSet(); using (SqlConnection connection = new SqlConnection(str)) { SqlCommand command = new SqlCommand(); command.Connection = connection; string strquery = "select Role_Cd from User_Role where AppCode='PM' and UserID = '" + currentUser + "'"; SqlCommand cmd = new SqlCommand(strquery, connection); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); } if (e.CommandName.Equals("Edit") && ds.Tables[0].Rows[0]["Role_Cd"].ToString().Trim() != "ADMIN") { int index = Convert.ToInt32(e.CommandArgument); GridView gvCurrentGrid = (GridView)sender; GridViewRow row = gvCurrentGrid.Rows[index]; string strID = ((Label)row.FindControl("lblID")).Text; string strAppName = ((Label)row.FindControl("lblAppName")).Text; Response.Redirect("AddApplication.aspx?ID=" + strID + "&AppName=" + strAppName + "&Edit=True"); } } } Kindly let me know if I need to add something. Thanks for any suggestions.

    Read the article

  • how to insert record in database with each date of month on single button click ?

    - by Mr. Goo
    I have two textbox .... textbox1 and textbox2 textbox1 == choose from date textbox2 == choose to date if user select from date in textbox1 as 01-May-2011 and in textbox2 as 30-May-2011 then all the dates from 01-MAy-2011 to 30-May-2011 will be inserted in each row of mssql2005 datatable... example. . : IN database Table1 structure ... ID Date 1 01-MAy-2011 2 02-MAy-2011 3 03-MAy-2011 4 04-MAy-2011 5 05-MAy-2011 and so on till 30-May-2011

    Read the article

  • Improving performance on data pasting 2000 rows with validations

    - by Lohit
    I have N rows (which could be nothing less than 1000) on an excel spreadsheet. And in this sheet our project has 150 columns like this: Now, our application needs data to be copied (using normal Ctrl+C) and pasted (using Ctrl+V) from the excel file sheet on our GUI sheet. Copy pasting 1000 records takes around 5-6 seconds which is okay for our requirement, but the problem is when we need to make sure the data entered is valid. So we have to validate data in each row generate appropriate error messages and format the data as per requirement. So we need to at runtime parse and evaluate data in each row. Now all the formatting of data and validations come from the back-end database and we have it in a data-table (dtValidateAndFormatConditions). The conditions would be around 50. So you can see how slow this whole process becomes since N X 150 X 50 operations are required to complete this whole process. Initially it took approximately 2-3 minutes but now i have reduced it to 20 - 30 seconds. However i have increased the speed by making an expression parser of my own - and not by any algorithm, is there any other way i can improve performance, by using Divide and Conquer or some other mechanism. Currently i am not really sure how to go about this. Here is what part of my code looks like: public virtual void ValidateAndFormatOnCopyPaste(DataTable DtCopied, int CurRow) { foreach (DataRow dRow in dtValidateAndFormatConditions.Rows) { string Condition = dRow["Condition"]; string FormatValue = Value = dRow["Value"]; GetValidatedFormattedData(DtCopied,ref Condition, ref FormatValue ,iRowIndex); Condition = Parse(Condition); dRow["Condition"] = Condition; FormatValue = Parse(FormatValue ); dRow["Value"] = FormatValue; } } The above code gets called row-wise like this: public override void ValidateAndFormat(DataTable dtChangedRecords, CellRange cr) { int iRowStart = cr.Row, iRowEnd = cr.Row + cr.RowCount; for (int iRow = iRowStart; iRow < iRowEnd; iRow++) { ValidateAndFormatOnCopyPaste(dtChangedRecords,iRow); } } Please know my question needs a more algorithmic solution than code optimization, however any answers containing code related optimizations will be appreciated as well. (Tagged Linq because although not seen i have been using linq in some parts of my code).

    Read the article

  • Using C# with Crystal Reports, How Can I Create 4-Up Subreports?

    - by C. Griffin
    The simplest example that I can provide for what I want to do is this: I need to create a Report, whose only requirement is that I have (4) of the same subreport on the page (imagine 4 portrait-oriented post cards on a page), each quadrant using a separate row from my datatable, yet all 4 are identical in terms of fields. If there are more than 4, it needs to carry over to a new page with the same format. I'm using C# and the built-in Crystal Reports Basic for the task.

    Read the article

  • how can i use a javascript in gridview row

    - by cagin
    hi there, I want to use a flash chart in a gridview. you can see my codes in below: DataTable tbl = new DataTable(); tbl.Columns.Add("chart"); DataRow rw; rw = tbl.NewRow(); rw["chart"] = @"<div id=""chart5Div""></div> <script type=""text/javascript""> var chart = new FusionCharts(""Charts/FCF_MSLine.swf"", ""ChId1"", ""500"", ""300""); var strXml = ""<graph numdivlines='4' lineThickness='3' showValues='0' numVDivLines='10' formatNumberScale='1' rotateNames='1' decimalPrecision='1' anchorRadius='2' anchorBgAlpha='0' numberPrefix='$' divLineAlpha='30' showAlternateHGridColor='1' yAxisMinValue='800000' shadowAlpha='50' >""; strXml += ""<categories >""; strXml += ""<category Name='Jan' />""; strXml += ""<category Name='Feb' />""; strXml += ""<category Name='Mar' />""; strXml += ""<category Name='Apr' />""; strXml += ""</categories >""; strXml += ""<dataset seriesName='Current Year' color='A66EDD' anchorBorderColor='A66EDD' anchorRadius='4'>""; strXml += ""<set value='1127654' />""; strXml += ""<set value='1226234' />""; strXml += ""<set value='1299456' />""; strXml += ""<set value='1311565' />""; strXml += ""</dataset>""; strXml += ""</graph>""; chart.setDataXML(strXml); chart.render(""chart5Div""); </script>"; tbl.Rows.Add(rw); GridView1.DataSource = tbl; GridView1.DataBind(); I must create dynamicly my datasource. But i can see just string value instead of my chart in gridview when page running. But chart code is running correctly between table tags. How can i use these codes in gridview?? KR

    Read the article

  • how to implement undo operation in datagridview

    - by ush
    Hi, I have created one application in c#.net.Using this application we can update datagridview,now i need to implement undo in it plz give me some ideas. private void button29_Click(object sender, EventArgs e) { Datatable dt; dt.RejectChanges(); } using above code i can do undo before updating. but i need a undo feature as in word plz suggest me thanks in advance

    Read the article

  • asp.net mvc viewdata best practices

    - by user319353
    Hi: Am trying to understand the ASP.NET MVC ViewData with respect to its size. Since this object is passed between Controller to View, how big this could be? Say for example, if DataTable is passed from Model, and Controller is going to pass it to View. Is there any best practices OR any one had any bad experience to share here? Thanks in advance.

    Read the article

  • I cant able to remove a row from a table while running through a loop

    - by Vibin Jith
    I am iterating through the table rows . if the row row is null I just want to remove the row. it shows an error Public Sub RemoveBlankRow(ByVal MyDataTable As DataTable) Try Dim MyRowStr As String = String.Empty For Each MyRow As DataRow In MyDataTable.Rows MyRowStr = "" For Each MyCellText As Object In MyRow.ItemArray MyRowStr = MyRowStr + MyCellText.ToString Next MyRowStr = Replace(MyRowStr, "0", " ") MyRowStr = Replace(MyRowStr, ".", " ") If MyRowStr.Trim = String.Empty Then MyDataTable.Rows.Remove(MyRow) End If Next Catch ex As Exception End Try End Sub How to overcome this issue?

    Read the article

  • T-SQL generated from LINQ to SQL is missing a where clause

    - by Jimmy W
    I have extended some functionality to a DataContext object (called "CodeLookupAccessDataContext") such that the object exposes some methods to return results of LINQ to SQL queries. Here are the methods I have defined: public List<CompositeSIDMap> lookupCompositeSIDMap(int regionId, int marketId) { var sidGroupId = CompositeSIDGroupMaps.Where(x => x.RegionID.Equals(regionId) && x.MarketID.Equals(marketId)) .Select(x => x.CompositeSIDGroup); IEnumerator<int> sidGroupIdEnum = sidGroupId.GetEnumerator(); if (sidGroupIdEnum.MoveNext()) return lookupCodeInfo<CompositeSIDMap, CompositeSIDMap>(x => x.CompositeSIDGroup.Equals(sidGroupIdEnum.Current), x => x); else return null; } private List<TResult> lookupCodeInfo<T, TResult>(Func<T, bool> compLambda, Func<T, TResult> selectLambda) where T : class { System.Data.Linq.Table<T> dataTable = this.GetTable<T>(); var codeQueryResult = dataTable.Where(compLambda) .Select(selectLambda); List<TResult> codeList = new List<TResult>(); foreach (TResult row in codeQueryResult) codeList.Add(row); return codeList; } CompositeSIDGroupMap and CompositeSIDMap are both tables in our database that are represented as objects in my DataContext object. I wrote the following code to call these methods and display the T-SQL generated after calling these methods: using (CodeLookupAccessDataContext codeLookup = new CodeLookupAccessDataContext()) { codeLookup.Log = Console.Out; List<CompositeSIDMap> compList = codeLookup.lookupCompositeSIDMap(5, 3); } I got the following results in my log after invoking this code: SELECT [t0].[CompositeSIDGroup] FROM [dbo].[CompositeSIDGroupMap] AS [t0] WHERE ([t0].[RegionID] = @p0) AND ([t0].[MarketID] = @p1) -- @p0: Input Int (Size = 0; Prec = 0; Scale = 0) [5] -- @p1: Input Int (Size = 0; Prec = 0; Scale = 0) [3] -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.30729.1 SELECT [t0].[PK_CSM], [t0].[CompositeSIDGroup], [t0].[InputSID], [t0].[TargetSID], [t0].[StartOffset], [t0].[EndOffset], [t0].[Scale] FROM [dbo].[CompositeSIDMap] AS [t0] -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.30729.1 The first T-SQL statement contains a where clause as specified and returns one column as expected. However, the second statement is missing a where clause and returns all columns, even though I did specify which rows I wanted to view and which columns were of interest. Why is the second T-SQL statement generated the way it is, and what should I do to ensure that I filter out the data according to specifications via the T-SQL? Also note that I would prefer to keep lookupCodeInfo() and especially am interested in keeping it enabled to accept lambda functions for specifying which rows/columns to return.

    Read the article

  • How to create Insert script using c#

    - by karthik
    From my c# code behind, i pass a query to mysql database and get the data in a DataTable. Now i want to use the data in data table to write the Insert query in a script file [.sql] The objective of doing so is, whatever records i select from mysql, i should write that to a script file as backup. Thais why i need the insert statements. How ? Or any other idea is appreciated.

    Read the article

  • Look over my C# SQLite Query, what am I doing wrong?

    - by CODe
    I'm writing a WinForms database application using SQLite and C#. I have a sqlite query that is failing, and I'm unsure as to where I'm going wrong, as I've tried everything I could think of. public DataTable searchSubs(String businessName, String contactName) { string SQL = null; if ((businessName != null && businessName != "") && (contactName != null && contactName != "")) { // provided business name and contact name for search SQL = "SELECT * FROM SUBCONTRACTOR WHERE BusinessName LIKE %@BusinessName% AND Contact LIKE %@ContactName%"; } else if ((businessName != null && businessName != "") && (contactName == null || contactName == "")) { // provided business name only for search SQL = "SELECT * FROM SUBCONTRACTOR WHERE BusinessName LIKE %@BusinessName%"; } else if ((businessName == null || businessName == "") && (contactName != null && contactName != "")) { // provided contact name only for search SQL = "SELECT * FROM SUBCONTRACTOR WHERE Contact LIKE %@ContactName%"; } else if ((businessName == null || businessName == "") && (contactName == null || contactName == "")) { // provided no search information SQL = "SELECT * FROM SUBCONTRACTOR"; } SQLiteCommand cmd = new SQLiteCommand(SQL); cmd.Parameters.AddWithValue("@BusinessName", businessName); cmd.Parameters.AddWithValue("@ContactName", contactName); cmd.Connection = connection; SQLiteDataAdapter da = new SQLiteDataAdapter(cmd); DataSet ds = new DataSet(); try { da.Fill(ds); DataTable dt = ds.Tables[0]; return dt; } catch (Exception e) { MessageBox.Show(e.ToString()); return null; } finally { cmd.Dispose(); connection.Close(); } } I continually get an error saying that it is failing near the %'s. That's all fine and dandy, but I guess I'm structuring it wrong, but I don't know where! I tried adding apostrophes around the "like" variables, like this: SQL = "SELECT * FROM SUBCONTRACTOR WHERE Contact LIKE '%@ContactName%'"; and quite honestly, that is all I can think of. Anyone have any ideas?

    Read the article

  • Call PHP Function in jQuery (var)

    - by l3gion
    Hello, I'm facing a small problem that I can't solve by myself. I have this php function: function intervalo_manha(){ $que="select id_intervalo,data_15 from intervalo_manha order by id_intervalo"; $re=mysql_query($que); $object.="<select>"; $object.="<option></option>"; while(list($id_intervalo, $data_15)=mysql_fetch_row($re)) { $object.= "<option value=\"".$id_intervalo."\">".$data_15."</option>"; } $object.="</select>"; return $object; } This function return a select with information from database. I also have this js function: $(document).ready(function() { var destTable = $("#dataTable"); $("#btnAdd").click(function() { var newRow = $("<tr style='margin-left:-60px'><td><INPUT type='checkbox' name='chk'/></td><td><INPUT type='text' name='txt[]' id='txt'/></td><td></td></tr>"); $("#dataTable").append(newRow); newRow.find('input').autocomplete("get_cols_name.php", { width: 260, matchContains: true, selectFirst: false }); }); }); This one will add a new row to my table, and for each new input will "activate" autocomplete. What I want to do is, instead of this: var newRow = $("<tr style='margin-left:-60px'><td><INPUT type='checkbox' name='chk'/></td><td><INPUT type='text' name='txt[]' id='txt'/></td><td></td></tr>"); I would like to have something like this: var newRow = $("<tr style='margin-left:-60px'><td><INPUT type='checkbox' name='chk'/></td><td><INPUT type='text' name='txt[]' id='txt'/></td><td><?php echo intervalo_manha(); ?></td></tr>"); Calling php function directly will return nothing, and I can't do anything. Is there any way to accomplish this? Thank you

    Read the article

  • Visual Studio Default Open File Action

    - by Kleinux
    I am using Visual Studio 2008 with C#. Is there a way to set the default editor for a class file containing a DataTable derived class? Whenever I double click on one of these classes to open the file VS attempts to open a component designer. Since my class isn't compatible with that editor this is a rather useless default. I would like these files to open up in the normal code editor.

    Read the article

  • LINQ Left Join And Right Join

    - by raja
    Hi, I need a help, I have two dataTable called A and B , i need all rows from A and matching row of B Ex: A: B: User | age| Data ID | age|Growth 1 |2 |43.5 1 |2 |46.5 2 |3 |44.5 1 |5 |49.5 3 |4 |45.6 1 |6 |48.5 I need Out Put: User | age| Data |Growth ------------------------ 1 |2 |43.5 |46.5 2 |3 |44.5 | 3 |4 |45.6 |

    Read the article

  • Problem While Using DataSource Property

    - by narmadha
    Hi, I am using DataSource Property to Bind the data into ComboBox using C# in the following manner: ComboBox1.DataSource=dt;//dt is the datatable which is having the values ComboBox1.DisplayMember="column1"; ComboBox1.ValueMember="column2"; The Problem is that i having all the values in the DataSource of the ComboBox1 i.e.totally five values,But the ComboBox1 count is 1 ,Dont know Why?Can anyone help me,Thanks in advance....................

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >