PC Review


Reply
Thread Tools Rate Thread

48 hours trying to make this work! Please Help!

 
 
=?Utf-8?B?Tkg=?=
Guest
Posts: n/a
 
      12th Aug 2005
Hi,
I just cannot get this to work. I want to make a cell editable in a datagrid
only if the value of another cell is something specific.

I am able to capture the value of the other cell via the ItemDataBound event
of the datagrid e.g.
If e.Item.Cells(8).Text = "2" Then
'Make the textbox defined in my edititemtemplate read only of invisible
End If

But now I just dont know how to prevent the user modifying the value of the
cell, it would be great if the edititemtemplate textbox just stayed invisible
whenever the user tries to edit the row where the value of the other cell is
e.g. 2.

Help really appreciated.
But
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2FjaGluIFNha2k=?=
Guest
Posts: n/a
 
      12th Aug 2005


"NH" ने लिखा:

> Hi,
> I just cannot get this to work. I want to make a cell editable in a datagrid
> only if the value of another cell is something specific.
>
> I am able to capture the value of the other cell via the ItemDataBound event
> of the datagrid e.g.
> If e.Item.Cells(8).Text = "2" Then
> 'Make the textbox defined in my edititemtemplate read only of invisible
> End If
>
> But now I just dont know how to prevent the user modifying the value of the
> cell, it would be great if the edititemtemplate textbox just stayed invisible
> whenever the user tries to edit the row where the value of the other cell is
> e.g. 2.
>
> Help really appreciated.
> But


If e.Item.Cells(8).Text = "2" Then
> 'Make the textbox defined in my edititemtemplate read only of invisible

''Whenever you find the value 2 you can find the textbox in that
row in itemdatabound event
Dim txtNewBox as textbox = DirectCast(e.item.FindControl("id of
textbox"),textbox)
If Not txtNewBox is nothing then
' Here you can set text box property
txtNewBox.readonly = true
End If
End If

I hope this will work for you. Let me know if any concerns

Regards,
Sachin Saki
 
Reply With Quote
 
=?Utf-8?B?Tkg=?=
Guest
Posts: n/a
 
      12th Aug 2005
Hi,
thanks for the response. It doesnt quite work however.

It has strange behaviour, the textbox in the edititemtemplate is always read
only regardless of my check. Even if I comment out the "txtNewBox.readonly =
true" code it is still read only.

But anyways what I would like to do is not to display the txtNewBox at all
as opposed to just making it read only. Am I right in putting this code in
the itemdatabound event of the datagrid?

"Sachin Saki" wrote:

>
>
> "NH" ने लिखा:
>
> > Hi,
> > I just cannot get this to work. I want to make a cell editable in a datagrid
> > only if the value of another cell is something specific.
> >
> > I am able to capture the value of the other cell via the ItemDataBound event
> > of the datagrid e.g.
> > If e.Item.Cells(8).Text = "2" Then
> > 'Make the textbox defined in my edititemtemplate read only of invisible
> > End If
> >
> > But now I just dont know how to prevent the user modifying the value of the
> > cell, it would be great if the edititemtemplate textbox just stayed invisible
> > whenever the user tries to edit the row where the value of the other cell is
> > e.g. 2.
> >
> > Help really appreciated.
> > But

>
> If e.Item.Cells(8).Text = "2" Then
> > 'Make the textbox defined in my edititemtemplate read only of invisible

> ''Whenever you find the value 2 you can find the textbox in that
> row in itemdatabound event
> Dim txtNewBox as textbox = DirectCast(e.item.FindControl("id of
> textbox"),textbox)
> If Not txtNewBox is nothing then
> ' Here you can set text box property
> txtNewBox.readonly = true
> End If
> End If
>
> I hope this will work for you. Let me know if any concerns
>
> Regards,
> Sachin Saki

 
Reply With Quote
 
=?Utf-8?B?ZG90bmV0dGVzdGVy?=
Guest
Posts: n/a
 
      12th Aug 2005
can't you make visible = false? for the text box? and if you need to make it
visible in postback , just set visible = true for the text box.

?

"NH" wrote:

> Hi,
> thanks for the response. It doesnt quite work however.
>
> It has strange behaviour, the textbox in the edititemtemplate is always read
> only regardless of my check. Even if I comment out the "txtNewBox.readonly =
> true" code it is still read only.
>
> But anyways what I would like to do is not to display the txtNewBox at all
> as opposed to just making it read only. Am I right in putting this code in
> the itemdatabound event of the datagrid?
>
> "Sachin Saki" wrote:
>
> >
> >
> > "NH" ने लिखा:
> >
> > > Hi,
> > > I just cannot get this to work. I want to make a cell editable in a datagrid
> > > only if the value of another cell is something specific.
> > >
> > > I am able to capture the value of the other cell via the ItemDataBound event
> > > of the datagrid e.g.
> > > If e.Item.Cells(8).Text = "2" Then
> > > 'Make the textbox defined in my edititemtemplate read only of invisible
> > > End If
> > >
> > > But now I just dont know how to prevent the user modifying the value of the
> > > cell, it would be great if the edititemtemplate textbox just stayed invisible
> > > whenever the user tries to edit the row where the value of the other cell is
> > > e.g. 2.
> > >
> > > Help really appreciated.
> > > But

> >
> > If e.Item.Cells(8).Text = "2" Then
> > > 'Make the textbox defined in my edititemtemplate read only of invisible

> > ''Whenever you find the value 2 you can find the textbox in that
> > row in itemdatabound event
> > Dim txtNewBox as textbox = DirectCast(e.item.FindControl("id of
> > textbox"),textbox)
> > If Not txtNewBox is nothing then
> > ' Here you can set text box property
> > txtNewBox.readonly = true
> > End If
> > End If
> >
> > I hope this will work for you. Let me know if any concerns
> >
> > Regards,
> > Sachin Saki

 
Reply With Quote
 
=?Utf-8?B?Tkg=?=
Guest
Posts: n/a
 
      12th Aug 2005
I have this code in the itemdatabound event..

If e.Item.Cells(8).Text = "2" Then

Dim t As TextBox =
DirectCast(e.Item.FindControl("txtPendingEd"), TextBox)
If Not t Is Nothing Then
t.Visible = False
End If
End If

e.Item.Cells(1).ToolTip = e.Item.Cells(7).Text

I have debugged and there are rows in the grid with cell(8) text of "2" yet
the TextBox declared above is always "nothing".

Does anyone have any code that they can test this in. I really cannot get
what seems like a simple thing to work.



"dotnettester" wrote:

> can't you make visible = false? for the text box? and if you need to make it
> visible in postback , just set visible = true for the text box.
>
> ?
>
> "NH" wrote:
>
> > Hi,
> > thanks for the response. It doesnt quite work however.
> >
> > It has strange behaviour, the textbox in the edititemtemplate is always read
> > only regardless of my check. Even if I comment out the "txtNewBox.readonly =
> > true" code it is still read only.
> >
> > But anyways what I would like to do is not to display the txtNewBox at all
> > as opposed to just making it read only. Am I right in putting this code in
> > the itemdatabound event of the datagrid?
> >
> > "Sachin Saki" wrote:
> >
> > >
> > >
> > > "NH" ने लिखा:
> > >
> > > > Hi,
> > > > I just cannot get this to work. I want to make a cell editable in a datagrid
> > > > only if the value of another cell is something specific.
> > > >
> > > > I am able to capture the value of the other cell via the ItemDataBound event
> > > > of the datagrid e.g.
> > > > If e.Item.Cells(8).Text = "2" Then
> > > > 'Make the textbox defined in my edititemtemplate read only of invisible
> > > > End If
> > > >
> > > > But now I just dont know how to prevent the user modifying the value of the
> > > > cell, it would be great if the edititemtemplate textbox just stayed invisible
> > > > whenever the user tries to edit the row where the value of the other cell is
> > > > e.g. 2.
> > > >
> > > > Help really appreciated.
> > > > But
> > >
> > > If e.Item.Cells(8).Text = "2" Then
> > > > 'Make the textbox defined in my edititemtemplate read only of invisible
> > > ''Whenever you find the value 2 you can find the textbox in that
> > > row in itemdatabound event
> > > Dim txtNewBox as textbox = DirectCast(e.item.FindControl("id of
> > > textbox"),textbox)
> > > If Not txtNewBox is nothing then
> > > ' Here you can set text box property
> > > txtNewBox.readonly = true
> > > End If
> > > End If
> > >
> > > I hope this will work for you. Let me know if any concerns
> > >
> > > Regards,
> > > Sachin Saki

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting work hours to day/hours/minutes WxmanPrice Microsoft Excel Misc 3 20th Oct 2009 03:08 PM
Trying to make a database for working hours versus absent from work Jan T. Microsoft Access Getting Started 3 6th May 2007 05:31 PM
Make a total of hours work in one day and end of week total =?Utf-8?B?Q2FybGllQ3VtbmVy?= Microsoft Access Reports 1 7th Jul 2006 04:19 AM
Apply a macro to all sheets - save me from hours and hours of work =?Utf-8?B?RXhjZWwnZWQgRmFpbHVyZXM=?= Microsoft Excel Programming 3 30th Jan 2006 05:48 PM
i need to make a formula that adds up my hours after my 40 hours =?Utf-8?B?am9obm55IHJvZHJpZ3Vleg==?= Microsoft Excel Misc 5 26th Oct 2005 05:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:30 PM.