Thursday, March 29, 2012
Set datagrid cell enabled to false
Here is my code that I tried:Dim cn As New OleDb.OleDbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;" _
& "Persist Security Info=False;" _
& "Initial Catalog=fuel info;" _
& "UID=;PWD=;" _
& "Data Source=Server7")
cn.Open()
Dim datAdapt As New OleDb.OleDbDataAdapter("Select Vendor_No as [Vendor No], " & _
"Vendor_Name as [Vendor Name], Vendor_Terminal as [Vendor Terminal], " & _
"Vendor_Trmnl_No As [Terminal No], Vendor_City As [City], Vendor_State As " & _
"[State], ID From Other_Vendors Order By Vendor_Name", cn)
Dim datSet As New Data.DataSet
datAdapt.Fill(datSet, "Other_Vendors")
DataGrid1.DataSource = datSet
DataGrid1.DataKeyField = "ID"
DataGrid1.EditItemIndex = e.Item.ItemIndex
e.Item.Cells(3).Enabled = False
DataGrid1.DataBind()
cn.Close()
cn.Dispose()
datAdapt.Dispose()
datSet.Dispose()
As you can see, the line that is not working is "e.item.cells(3).enabled = false"
Also, if anyone knows how to set the width of the cell on the fly as well, I would appreciate that as well.
ThanksTry looking into the ItemDataBound sub and adding
e.Item.Cells(3).Enabled = False
in there. You cant disable the cells before the data is in them. RIght now you are trying to disable that cell before the data has been bound to the grid.
Jerel
Phelnglai, that did the trick. One more quick question. Could you set the cell width from the same place? If so, do you know the syntax? Thanks.
What about the cell header? What would the syntax be for that?
Thanks again!
Nevermind, I see that if you just increase the width of the actual datagrid, the fields will increase and adjust on their own at run time.
Glad you got it. Sorry I never answered your second question. I was in a car wreck and am just now getting back to work and doing thinks.
If you have any other questions, feel free to ask.
Jerel
Tuesday, March 13, 2012
Set page to focus some certain location after post back
I have a web form, after post back to itself, I need to make web page
scroll to some certian location instead of top. We only care IE.
Anybody has some idea how to do it?
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours HardyIf you want a purist MS position, look at Smart Navigation.
//C#
Page.SmartNavigation=true;
Another option:
http://aspnet.4guysfromrolla.com/ar...111704-1.2.aspx
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Hardy Wang" wrote:
> Hi,
> I have a web form, after post back to itself, I need to make web page
> scroll to some certian location instead of top. We only care IE.
> Anybody has some idea how to do it?
> --
> WWW: http://hardywang.1accesshost.com
> ICQ: 3359839
> yours Hardy
>
>
Not maintain post back position, but scroll to certain location.
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message news:0C35D26C-5F0F-4DDB-A56A-BFCD12B5CB51@.microsoft.com...
> If you want a purist MS position, look at Smart Navigation.
> //C#
> Page.SmartNavigation=true;
> Another option:
> http://aspnet.4guysfromrolla.com/ar...111704-1.2.aspx
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
> "Hardy Wang" wrote:
>
You will probably need to do this by using Javascript and using anchor
tags.
Place name anchors throughout the page like:
<a name="top">Top</a>
<a name="middle">Middle</a>
<a name="bottom">Bottom</a>
Then you could push Javascript out from the code-behind something like:
<script>
window.navigate('#bottom');
</script>
The page would then scroll to the bottom. Just make sure your
javascript appears last in the page after all the sections of the page
have been named...
If you know the postition you want.
//client side script
function __dascwebLoadScrollPosition( top, left )
{
window.document.body.scrollLeft = top;
window.document.body.scrollTop = left;
}
You can set the scrollLeft and scrollTop of the body. If you don't know the
position, you can do aa7im suggested with anchor tags.
bill
"Hardy Wang" <hardywang@.hotmail.com> wrote in message
news:%23HRqRkV3EHA.208@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I have a web form, after post back to itself, I need to make web page
> scroll to some certian location instead of top. We only care IE.
> Anybody has some idea how to do it?
> --
> WWW: http://hardywang.1accesshost.com
> ICQ: 3359839
> yours Hardy
>
Set page to focus some certain location after post back
I have a web form, after post back to itself, I need to make web page
scroll to some certian location instead of top. We only care IE.
Anybody has some idea how to do it?
--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours HardyIf you want a purist MS position, look at Smart Navigation.
//C#
Page.SmartNavigation=true;
Another option:
http://aspnet.4guysfromrolla.com/ar...111704-1.2.aspx
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Hardy Wang" wrote:
> Hi,
> I have a web form, after post back to itself, I need to make web page
> scroll to some certian location instead of top. We only care IE.
> Anybody has some idea how to do it?
> --
> WWW: http://hardywang.1accesshost.com
> ICQ: 3359839
> yours Hardy
>
Not maintain post back position, but scroll to certain location.
--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message news:0C35D26C-5F0F-4DDB-A56A-BFCD12B5CB51@.microsoft.com...
> If you want a purist MS position, look at Smart Navigation.
> //C#
> Page.SmartNavigation=true;
> Another option:
> http://aspnet.4guysfromrolla.com/ar...111704-1.2.aspx
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
> "Hardy Wang" wrote:
>> Hi,
>> I have a web form, after post back to itself, I need to make web page
>> scroll to some certian location instead of top. We only care IE.
>> Anybody has some idea how to do it?
>>
>> --
>> WWW: http://hardywang.1accesshost.com
>> ICQ: 3359839
>> yours Hardy
>>
>>
>
You will probably need to do this by using Javascript and using anchor
tags.
Place name anchors throughout the page like:
<a name="top">Top</a>
<a name="middle">Middle</a>
<a name="bottom">Bottom</a
Then you could push Javascript out from the code-behind something like:
<script>
window.navigate('#bottom');
</script
The page would then scroll to the bottom. Just make sure your
javascript appears last in the page after all the sections of the page
have been named...
If you know the postition you want.
//client side script
function __dascwebLoadScrollPosition( top, left )
{
window.document.body.scrollLeft = top;
window.document.body.scrollTop = left;
}
You can set the scrollLeft and scrollTop of the body. If you don't know the
position, you can do aa7im suggested with anchor tags.
bill
"Hardy Wang" <hardywang@.hotmail.com> wrote in message
news:%23HRqRkV3EHA.208@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I have a web form, after post back to itself, I need to make web page
> scroll to some certian location instead of top. We only care IE.
> Anybody has some idea how to do it?
> --
> WWW: http://hardywang.1accesshost.com
> ICQ: 3359839
> yours Hardy