473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

gridview question

how to set the width of BoundField textbox when it is displayed in edit mode ?

Jan 25 '07 #1
5 3200
i do this in code if you need to do it dynamicly. Try this, i have not tested
this, but it should work. Please let me know.

use the rowediting event to find the text box and then set the width.
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Dim tb As TextBox =
Me.GridView1.Rows(Me.GridView1.SelectedIndex).Cell s(3).FindControl("mytextbox")

tb.Width = 75
End Sub
you need to know the cell number and the name of the text box where your
template field is.
Try this
--
Share The Knowledge. I need all the help I can get and so do you!
"Jon Paal" wrote:
how to set the width of BoundField textbox when it is displayed in edit mode ?

Jan 25 '07 #2
on second pass, I can't get my sode to work eather. Should have tried this
first.
if you do find the answer i would really like to know!
thanks and appologies for the untesed answer
--
Share The Knowledge. I need all the help I can get and so do you!
"Yankee Imperialist Dog" wrote:
i do this in code if you need to do it dynamicly. Try this, i have not tested
this, but it should work. Please let me know.

use the rowediting event to find the text box and then set the width.
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Dim tb As TextBox =
Me.GridView1.Rows(Me.GridView1.SelectedIndex).Cell s(3).FindControl("mytextbox")

tb.Width = 75
End Sub
you need to know the cell number and the name of the text box where your
template field is.
Try this
--
Share The Knowledge. I need all the help I can get and so do you!
"Jon Paal" wrote:
how to set the width of BoundField textbox when it is displayed in edit mode ?


Jan 25 '07 #3
it's not a template field it's a bound field.

I resolved the problem by using an external css file setting the html input tag to a specified width.

thanks for trying.
"Yankee Imperialist Dog" <Ya******************@discussions.microsoft.comwro te in message
news:73**********************************@microsof t.com...
>i do this in code if you need to do it dynamicly. Try this, i have not tested
this, but it should work. Please let me know.

use the rowediting event to find the text box and then set the width.
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Dim tb As TextBox =
Me.GridView1.Rows(Me.GridView1.SelectedIndex).Cell s(3).FindControl("mytextbox")

tb.Width = 75
End Sub
you need to know the cell number and the name of the text box where your
template field is.
Try this
--
Share The Knowledge. I need all the help I can get and so do you!
"Jon Paal" wrote:
>how to set the width of BoundField textbox when it is displayed in edit mode ?


Jan 25 '07 #4
thanks for trying

I am using a bound field not a template filed.

I resolved the problem by using an external css file setting the input tag to a specified width

"Yankee Imperialist Dog" <Ya******************@discussions.microsoft.comwro te in message
news:73**********************************@microsof t.com...
>i do this in code if you need to do it dynamicly. Try this, i have not tested
this, but it should work. Please let me know.

use the rowediting event to find the text box and then set the width.
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Dim tb As TextBox =
Me.GridView1.Rows(Me.GridView1.SelectedIndex).Cell s(3).FindControl("mytextbox")

tb.Width = 75
End Sub
you need to know the cell number and the name of the text box where your
template field is.
Try this
--
Share The Knowledge. I need all the help I can get and so do you!
"Jon Paal" wrote:
>how to set the width of BoundField textbox when it is displayed in edit mode ?


Jan 25 '07 #5
for what it's worth you can just set the width of the text box after you
convert it to a template field. It is not dynamic, but it may do what you want
1. convert column to a template
2. select edit templates
3. select the edit template
4. change the width property
thanks
and sorry again about the previous answer.
--
Share The Knowledge. I need all the help I can get and so do you!
"Jon Paal" wrote:
how to set the width of BoundField textbox when it is displayed in edit mode ?

Jan 25 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
4
by: Nalaka | last post by:
Hi, I have two questions about gridViews. 1. How can I intercept the row/column values at loading to change values? 2. After I update a row (using default update functionality), how can I...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
1
by: Giovanni | last post by:
Dear Friends/Gurus, I have exhausted myself and have yet no solution to the following: I have an ASP.NET 2.0 Survey type application. On a page, I have placed a GridView which is bound to an...
4
by: Chris | last post by:
Hi, I read about client callback and i have a question. Assume the option "sorting" is set in a gridview. Each time the user clicks on a fieldname, the data are sorted. My question is: are...
3
by: Gonza | last post by:
Hi group, i have a question relatred to gridview and postback (i should probably know this by now, considering i've been working with .net for a few years now, but baahh). Why could a gridview...
1
by: Barry L. Camp | last post by:
Hi all, Wondering if someone can help with a nagging problem I am having using a GridView and an ObjectDataSource. I have a simple situation where I am trying to delete a row from a table, but...
4
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have a vb.net 2.0 app that is loading a GridView with a DataSource that is returned from a function. The definitions in the function are: Dim ReportDS As DataSet = New DataSet Dim...
1
by: Cirene | last post by:
This is confusing... I have a gridview (gv1) with another gridview (gv2) inside of it. gv1 has a bunch of house listings and within each row is a group of related house pictures (gv2). I'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.