Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / November 2007

Tip: Looking for answers? Try searching our database.

Having terrible time replacing a textbox in a gridview with another type in edit mode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
anonymoushamster - 13 Nov 2007 14:52 GMT
Whether it is a checkbox to be replcaed with and image or a textbox to
be repalced with a dropdown, imfailing.

One simple reason.  I can add a new compoentn into the edit row ,I
jsut cant replace an existing one or fin done to then set it to
invisible.

Any help, greatly appreciated.

Many thanks,
hamsters
anonymoushamster - 13 Nov 2007 15:00 GMT
Sorry anonymous, please forgive my terrible spelling.

Just to make it clear.

I want replace the edit row which displays data in textboxes to
display the dat aas dropdowns. I can add dropdowns but I cant remove
the textboxes and I am not sure how to refer them.

How should I go about solving this?

Thanks again,
hamsters
GaiaMH@gmail.com - 13 Nov 2007 15:31 GMT
On Nov 13, 10:00 am, anonymoushamster <anonymoushams...@gmail.com>
wrote:
> Sorry anonymous, please forgive my terrible spelling.
>
[quoted text clipped - 8 lines]
> Thanks again,
> hamsters

You can use the OnRowEditing event of the gridview to specify you own
event handler :

<asp:GridView ID="GridView1" runat="server" ...
OnRowEditing="editRow" />

In your code you add an event handling method :

   protected void editRow(object sender, GridViewEditEventArgs e)
   {
       e.Cancel = true;
       GridView1.Rows[e.NewEditIndex].Cells[0].Text = "Changed";
   }

e.Cancel = true; will disable the event and asp.net won't add the
textbox.
e.NewEditIndex is the row index of the selected row.

>From there you can call your code to generate the dropdown list, I'm
not sure how the RowUpdating event will be affected by this, but you
can always custom handle that also.
hamsterchaos@gmail.com - 13 Nov 2007 15:39 GMT
On Nov 13, 3:31 pm, "Gai...@gmail.com" <Gai...@gmail.com> wrote:
> On Nov 13, 10:00 am, anonymoushamster <anonymoushams...@gmail.com>
> wrote:
[quoted text clipped - 34 lines]
> not sure how the RowUpdating event will be affected by this, but you
> can always custom handle that also.

actually htis is a far superior solution - thank you very much!
hamsterchaos@gmail.com - 13 Nov 2007 15:33 GMT
On Nov 13, 3:00 pm, anonymoushamster <anonymoushams...@gmail.com>
wrote:
> Sorry anonymous, please forgive my terrible spelling.
>
[quoted text clipped - 8 lines]
> Thanks again,
> hamsters

autogenerate columns must be off - sorted

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.