.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to use Trim Function in gridview

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :ASP.Net
<asp:TemplateField HeaderText="status" SortExpression="status"> <ItemTemplate>  <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("status") %>'></asp:TextBox> <asp:RadioButtonList ID="rbgpstatus" runat="server" SelectedValue='<%# Bind("status") %>'> <asp:ListItem Value="S">Scheduled</asp:ListItem> <asp:ListItem Value="Approved">Approved</asp:ListItem> <asp:ListItem Value="R">Rejected</asp:ListItem> </asp:RadioButtonList> </ItemTemplate> </asp:TemplateField>   my radio buttonlist always comes up eith error that 'rbgpstatus' has a SelectedValue which is invalid because it does not exist in the list of items....so i winder the bind property of status got some extraspace in left and right side...i want to use trim before bind("status")..how to use that   

View Complete Post

More Related Resource Links

Trim function in C Sharp

How do i use "trim" function in C Sharp? I have a string and i want to strip off spaces from the end of the string. Any idea how do i do it??


How can i pass function as parameter to show in gridview

Hello, I have one common Data Access function which returns output as dataset which is as below   Public Shared Function ExecuteDataSet(ByVal sql As String, ByVal type As CommandType, ByVal ParamArray parameters As SqlParameter()) As DataSetDim RetVal As Object = Nothing   Try Cmd = Cmd.Connection = OpenConnection() Cmd.CommandType = type Cmd.CommandText = sql Cmd.Parameters.AddRange(parameters) Sda = Ds = Sda.Fill(Ds)       New SqlCommand()New SqlDataAdapter(Cmd)New DataSetCatch ex As ExceptionThrow New Exception(ex.Message.ToString())Finally CloseConnection() Sda.Dispose() End Try   Return Ds End Function   this function normally i use to get data from database and returns to dataset   now,I want to created one more function which output type is gridview and its parameter is  dataset which i got output in previous funtion   i want like this public funtion BindDatatoGridView(ExecuteDataSet("SELECT...",commandType.text,Parameter....)) as GridView End Function   how can i solve this, please help me out

pass number of rows of Gridview to a javascript function

using vb.net/asp.net 2005.I need to pass the number of rows of the Gridview to a javascript function does anyone know how to do this?  thanks

Filtering with gridview + (search function)

      have a gridview and  6 dropdownlists which I want to use to filter data in gridview I am using this code below Try            strSql = "Select * from aspnet_Users where UserName = " & Me.DropDownList1.SelectedItem.Text            Call OpenConnection()            Call GiveCommand(strSql)            sqlMyCmd.ExecuteNonQuery()            Me.GridView1.DataSource = sqlMyCmd.ExecuteReader            Me.GridView1.DataBind()            Call EndConnect()        Catch ex As InvalidOperationException        Catch ex2 As SqlException        Catch ex As NullReferenceException        End Try what im trying to acheive on the page is to allow user to pick a value from any1 of the 6 dropdownlist (representing  6 fields) and when btnSearch is clicked Gridview displays the data the code I have above allows me to do this with one dropdown

GridView Edit Update function


 I have a gridview and am using the Edit - Update function to update one field in my gridview. I have the textbox appearing as I want it and am able to update the data for that cell.

The problem I have is refreshing the gridview after the update. The Update and cancel are still shown instead of the gridview refreshing back to the Edit statement after the update.

Any ideas what I need to add to get the gridview column to refresh back to the edit statement?


how to capture value of javascript function called by GridView Linkbutton Click



i have gridview with linkbutton.when i click linkbutton it should call javascript function which returns value would be input for database functions.

how do i capture javascript function retun value(i am using Registerclientscriptblock)? and that should be input for database function.

Inshort i need to call two function from link button click - one javascript function,one ado.net function which will update value in database.

output of javascript function will be input for database function.

function Getlogitudelantitude(address)


return "35.3434343,-74.334343"


Linkbutton_click(object sender,Eventargs e)


register javascript function .. which should return value

string s = "35.34343,-74.334343"

then call database function(s) - does database operation


please reply..



AllowPage and Excel function in Gridview


I have a grdiview that has about 50 columns and the users usually want to see more then 3000 rows of data. The process is kind of slow but the bigger problem is that the application crashes when the user tries to see a large amount of data. Right now, on the gridview, allowpage is set to false and have an excel button.

My question is, when I click the excel button, does it just grab it from the gridview and export to excel sheet when allowpage is set to false? on the other hand, if I set allowpage to true, (i want to show 100 rows per page) does it go back to server again to grab the whole data if there are more then 1 pages of data?

how can i make this webpage more efficiently? please let me know if you need more information. I do not really know how to explain this problem well. advise me, thanks.

Gridview + Search Function


Does anyone know where i can find good toturials where you can make a search function and show the results in a gridview?

Tutorials are welkom.


Inplace Edit in GridView

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

GridView Confirmation Box Using JQuery BlockUI in asp.net

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Textbox Editable GridView in ASP.NET

This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

AJAX GridView Paging and Sorting using C# in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

GridView Paging Using Ajax in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

Displaying Row Details Tooltip on GridView using JQuery

Continuing exploring JQuery! I decided to implement a feature to display some kind of details related to a row displayed on GridView. For example when displaying employees details on GridView some information might not fit in the GridView because it will make it huge and wide. These infomration can be diplayed as Tooltip. Or when you want to display a picture and some kind of formated text to be diplayed as tooltip when mouse hover on the image.

jQuery: Highlight Gridview Rows with Checkbox

Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

Gridview setup:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend