Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Hiding a field in a repeater

Reply
Thread Tools

Hiding a field in a repeater

 
 
JJ297
Guest
Posts: n/a
 
      03-31-2008
I want to hide the Pin field below in my repeater. How do I do this?

<asp:Repeater ID="Repeater1" runat="server"
DataSourceID="SqlDataSource1">

<ItemTemplate>
<tr>
<td><font color="#330099">Claim SSN: </font><b><%#
Eval("ClaimSSN") %></b></td>
<td colspan="2"></td>
<td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
b></td>

<td colspan="2"></td>

<td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
Eval("BICSSN") %></b></td>

<tr></tr>
<td colspan="7"></td>

<td colspan="7"><font color="#330099">Status Code: </font><b><
%# Eval("StatusCode")%></b></td>

<td><label runat="server" id="lbl"><font color="#330099">Pin:
</font><b><%#Eval("Pin")%></label></b></tr>
</ItemTemplate>
<SeparatorTemplate>
<tr>
<td colspan="100%"><hr size="1" color=#330099 /><br />

</td>
</tr>
</SeparatorTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
 
Reply With Quote
 
 
 
 
George Ter-Saakov
Guest
Posts: n/a
 
      03-31-2008
By hiding what exactly you mean???

Do it like <!--<%#Eval("Pin")%>--> and it will be hidden in a browser....

Or how about not to have <%#Eval("Pin")%> at all? It will be really hidden
then

George.


"JJ297" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I want to hide the Pin field below in my repeater. How do I do this?
>
> <asp:Repeater ID="Repeater1" runat="server"
> DataSourceID="SqlDataSource1">
>
> <ItemTemplate>
> <tr>
> <td><font color="#330099">Claim SSN: </font><b><%#
> Eval("ClaimSSN") %></b></td>
> <td colspan="2"></td>
> <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
> b></td>
>
> <td colspan="2"></td>
>
> <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
> Eval("BICSSN") %></b></td>
>
> <tr></tr>
> <td colspan="7"></td>
>
> <td colspan="7"><font color="#330099">Status Code: </font><b><
> %# Eval("StatusCode")%></b></td>
>
> <td><label runat="server" id="lbl"><font color="#330099">Pin:
> </font><b><%#Eval("Pin")%></label></b></tr>
> </ItemTemplate>
> <SeparatorTemplate>
> <tr>
> <td colspan="100%"><hr size="1" color=#330099 /><br />
>
> </td>
> </tr>
> </SeparatorTemplate>
> <FooterTemplate>
> </table>
> </FooterTemplate>
> </asp:Repeater>



 
Reply With Quote
 
 
 
 
JJ297
Guest
Posts: n/a
 
      03-31-2008
On Mar 31, 2:52*pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
> By hiding what exactly you mean???
>
> Do it like <!--<%#Eval("Pin")%>--> and it will be hidden in a browser....
>
> Or how about not to have <%#Eval("Pin")%> at all? It will be really hidden
> then
>
> George.
>
> "JJ297" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> >I want to hide the Pin field below in my repeater. *How do I do this?

>
> > <asp:Repeater ID="Repeater1" runat="server"
> > DataSourceID="SqlDataSource1">

>
> > * * * * * <ItemTemplate>
> > * * * *<tr>
> > * * * *<td><font color="#330099">Claim SSN: </font><b><%#
> > Eval("ClaimSSN") %></b></td>
> > * * * * <td colspan="2"></td>
> > * * * * <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
> > b></td>

>
> > * * * * <td colspan="2"></td>

>
> > * * * * <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
> > Eval("BICSSN") %></b></td>

>
> > * * * * <tr></tr>
> > * * * * <td colspan="7"></td>

>
> > * * * * <td colspan="7"><font color="#330099">Status Code: </font><b><
> > %# Eval("StatusCode")%></b></td>

>
> > * * * *<td><label runat="server" id="lbl"><font color="#330099">Pin:
> > </font><b><%#Eval("Pin")%></label></b></tr>
> > * * * *</ItemTemplate>
> > * * *<SeparatorTemplate>
> > * * * *<tr>
> > * * * *<td colspan="100%"><hr size="1" color=#330099 /><br />

>
> > * * * *</td>
> > * * * *</tr>
> > * * * *</SeparatorTemplate>
> > * * * *<FooterTemplate>
> > * * * *</table>
> > * * * *</FooterTemplate>
> > * * * *</asp:Repeater>- Hide quoted text -

>
> - Show quoted text -


I want to put security on the page if the person has manager rights
they will have the Pin field visible.

So I will put something like:

If Session(CSI) = true then

the pin field is visible

else

the pin field in not visible

I hope that makes sense
I want the Pin field

 
Reply With Quote
 
George Ter-Saakov
Guest
Posts: n/a
 
      03-31-2008
I see it now....
The best way to do is following....
in your code on the page make a function (C# example, but you should not
have a problem to convert it to VB.NET)

protected string GetPin(string sPin)
{
if( _iLevel > 1 )
return sPin;
else
return "******";
}


in your aspx page instead of
<%#Eval("Pin")%>
have something like
<%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>


Remember, Eval is the function and you always can create your own
version.....


George.








"JJ297" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Mar 31, 2:52 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
> By hiding what exactly you mean???
>
> Do it like <!--<%#Eval("Pin")%>--> and it will be hidden in a browser....
>
> Or how about not to have <%#Eval("Pin")%> at all? It will be really hidden
> then
>
> George.
>
> "JJ297" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> >I want to hide the Pin field below in my repeater. How do I do this?

>
> > <asp:Repeater ID="Repeater1" runat="server"
> > DataSourceID="SqlDataSource1">

>
> > <ItemTemplate>
> > <tr>
> > <td><font color="#330099">Claim SSN: </font><b><%#
> > Eval("ClaimSSN") %></b></td>
> > <td colspan="2"></td>
> > <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
> > b></td>

>
> > <td colspan="2"></td>

>
> > <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
> > Eval("BICSSN") %></b></td>

>
> > <tr></tr>
> > <td colspan="7"></td>

>
> > <td colspan="7"><font color="#330099">Status Code: </font><b><
> > %# Eval("StatusCode")%></b></td>

>
> > <td><label runat="server" id="lbl"><font color="#330099">Pin:
> > </font><b><%#Eval("Pin")%></label></b></tr>
> > </ItemTemplate>
> > <SeparatorTemplate>
> > <tr>
> > <td colspan="100%"><hr size="1" color=#330099 /><br />

>
> > </td>
> > </tr>
> > </SeparatorTemplate>
> > <FooterTemplate>
> > </table>
> > </FooterTemplate>
> > </asp:Repeater>- Hide quoted text -

>
> - Show quoted text -


I want to put security on the page if the person has manager rights
they will have the Pin field visible.

So I will put something like:

If Session(CSI) = true then

the pin field is visible

else

the pin field in not visible

I hope that makes sense
I want the Pin field


 
Reply With Quote
 
JJ297
Guest
Posts: n/a
 
      03-31-2008
On Mar 31, 3:33*pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
> I see it now....
> The best way to do is following....
> in your code on the page make a function (C# example, but you should not
> have a problem to convert it to VB.NET)
>
> protected string GetPin(string sPin)
> {
> * * if( _iLevel > 1 )
> * * * * return sPin;
> * * else
> * * * * return "******";
>
> }
>
> in your aspx page instead of
> <%#Eval("Pin")%>
> have something like
> <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>
>
> Remember, *Eval is the function and you always can create your own
> version.....
>
> George.
>
> "JJ297" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Mar 31, 2:52 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > By hiding what exactly you mean???

>
> > Do it like <!--<%#Eval("Pin")%>--> and it will be hidden in a browser.....

>
> > Or how about not to have <%#Eval("Pin")%> at all? It will be really hidden
> > then

>
> > George.

>
> > "JJ297" <(E-Mail Removed)> wrote in message

>
> >news:(E-Mail Removed)...

>
> > >I want to hide the Pin field below in my repeater. How do I do this?

>
> > > <asp:Repeater ID="Repeater1" runat="server"
> > > DataSourceID="SqlDataSource1">

>
> > > <ItemTemplate>
> > > <tr>
> > > <td><font color="#330099">Claim SSN: </font><b><%#
> > > Eval("ClaimSSN") %></b></td>
> > > <td colspan="2"></td>
> > > <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
> > > b></td>

>
> > > <td colspan="2"></td>

>
> > > <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
> > > Eval("BICSSN") %></b></td>

>
> > > <tr></tr>
> > > <td colspan="7"></td>

>
> > > <td colspan="7"><font color="#330099">Status Code: </font><b><
> > > %# Eval("StatusCode")%></b></td>

>
> > > <td><label runat="server" id="lbl"><font color="#330099">Pin:
> > > </font><b><%#Eval("Pin")%></label></b></tr>
> > > </ItemTemplate>
> > > <SeparatorTemplate>
> > > <tr>
> > > <td colspan="100%"><hr size="1" color=#330099 /><br />

>
> > > </td>
> > > </tr>
> > > </SeparatorTemplate>
> > > <FooterTemplate>
> > > </table>
> > > </FooterTemplate>
> > > </asp:Repeater>- Hide quoted text -

>
> > - Show quoted text -

>
> I want to put security on the page if the person has manager rights
> they will have the Pin field visible.
>
> So I will put something like:
>
> If Session(CSI) = true then
>
> the pin field is visible
>
> else
>
> the pin field in not visible
>
> I hope that makes sense
> I want the Pin field- Hide quoted text -
>
> - Show quoted text -


A little confused... like this:

Function getPin(ByVal sPin)


If Session(CSI) = True Then
Return sPin.visible = False

End If
End Function
 
Reply With Quote
 
George Ter-Saakov
Guest
Posts: n/a
 
      04-01-2008
The idea to output to browser Pin or nothing to the user if he does not have
permissions. It's a little different aproach than just hiding this column
which is in HTML word might be prefered way.

so in C# code it will be
protected string GetPin(string sPin)
{
if (Session("CSI") == true)
return sPin
else
return "&nbsp;" //or anything you want
}


And on your page you have

<%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>

This line will call your GetPin for every row and output sPin or &nbsp;
depends on what is in Session("CSI")




George.

"JJ297" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Mar 31, 3:33 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
> I see it now....
> The best way to do is following....
> in your code on the page make a function (C# example, but you should not
> have a problem to convert it to VB.NET)
>
> protected string GetPin(string sPin)
> {
> if( _iLevel > 1 )
> return sPin;
> else
> return "******";
>
> }
>
> in your aspx page instead of
> <%#Eval("Pin")%>
> have something like
> <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>
>
> Remember, Eval is the function and you always can create your own
> version.....
>
> George.
>
> "JJ297" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Mar 31, 2:52 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > By hiding what exactly you mean???

>
> > Do it like <!--<%#Eval("Pin")%>--> and it will be hidden in a
> > browser....

>
> > Or how about not to have <%#Eval("Pin")%> at all? It will be really
> > hidden
> > then

>
> > George.

>
> > "JJ297" <(E-Mail Removed)> wrote in message

>
> >news:(E-Mail Removed)...

>
> > >I want to hide the Pin field below in my repeater. How do I do this?

>
> > > <asp:Repeater ID="Repeater1" runat="server"
> > > DataSourceID="SqlDataSource1">

>
> > > <ItemTemplate>
> > > <tr>
> > > <td><font color="#330099">Claim SSN: </font><b><%#
> > > Eval("ClaimSSN") %></b></td>
> > > <td colspan="2"></td>
> > > <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
> > > b></td>

>
> > > <td colspan="2"></td>

>
> > > <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
> > > Eval("BICSSN") %></b></td>

>
> > > <tr></tr>
> > > <td colspan="7"></td>

>
> > > <td colspan="7"><font color="#330099">Status Code: </font><b><
> > > %# Eval("StatusCode")%></b></td>

>
> > > <td><label runat="server" id="lbl"><font color="#330099">Pin:
> > > </font><b><%#Eval("Pin")%></label></b></tr>
> > > </ItemTemplate>
> > > <SeparatorTemplate>
> > > <tr>
> > > <td colspan="100%"><hr size="1" color=#330099 /><br />

>
> > > </td>
> > > </tr>
> > > </SeparatorTemplate>
> > > <FooterTemplate>
> > > </table>
> > > </FooterTemplate>
> > > </asp:Repeater>- Hide quoted text -

>
> > - Show quoted text -

>
> I want to put security on the page if the person has manager rights
> they will have the Pin field visible.
>
> So I will put something like:
>
> If Session(CSI) = true then
>
> the pin field is visible
>
> else
>
> the pin field in not visible
>
> I hope that makes sense
> I want the Pin field- Hide quoted text -
>
> - Show quoted text -


A little confused... like this:

Function getPin(ByVal sPin)


If Session(CSI) = True Then
Return sPin.visible = False

End If
End Function


 
Reply With Quote
 
JJ297
Guest
Posts: n/a
 
      04-01-2008
On Apr 1, 7:57*am, "George Ter-Saakov" <(E-Mail Removed)> wrote:
> The idea to output to browser Pin or nothing to the user if he does not have
> permissions. It's a little different aproach than just hiding this column
> which is in HTML word might be prefered way.
>
> so in C# code it will be
> protected string GetPin(string sPin)
> {
> * * * * if (Session("CSI") == true)
> * * * * * * return sPin
> * * * * else
> * * * * * * return "&nbsp;" //or anything you want
>
> }
>
> And on your page you have
>
> <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>
>
> This line will call your GetPin for every row and output sPin or &nbsp;
> depends on what is in Session("CSI")
>
> George.
>
> "JJ297" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Mar 31, 3:33 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > I see it now....
> > The best way to do is following....
> > in your code on the page make a function (C# example, but you should not
> > have a problem to convert it to VB.NET)

>
> > protected string GetPin(string sPin)
> > {
> > if( _iLevel > 1 )
> > return sPin;
> > else
> > return "******";

>
> > }

>
> > in your aspx page instead of
> > <%#Eval("Pin")%>
> > have something like
> > <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>

>
> > Remember, Eval is the function and you always can create your own
> > version.....

>
> > George.

>
> > "JJ297" <(E-Mail Removed)> wrote in message

>
> >news:(E-Mail Removed)...
> > On Mar 31, 2:52 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:

>
> > > By hiding what exactly you mean???

>
> > > Do it like <!--<%#Eval("Pin")%>--> and it will be hidden in a
> > > browser....

>
> > > Or how about not to have <%#Eval("Pin")%> at all? It will be really
> > > hidden
> > > then

>
> > > George.

>
> > > "JJ297" <(E-Mail Removed)> wrote in message

>
> > >news:(E-Mail Removed)....

>
> > > >I want to hide the Pin field below in my repeater. How do I do this?

>
> > > > <asp:Repeater ID="Repeater1" runat="server"
> > > > DataSourceID="SqlDataSource1">

>
> > > > <ItemTemplate>
> > > > <tr>
> > > > <td><font color="#330099">Claim SSN: </font><b><%#
> > > > Eval("ClaimSSN") %></b></td>
> > > > <td colspan="2"></td>
> > > > <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
> > > > b></td>

>
> > > > <td colspan="2"></td>

>
> > > > <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
> > > > Eval("BICSSN") %></b></td>

>
> > > > <tr></tr>
> > > > <td colspan="7"></td>

>
> > > > <td colspan="7"><font color="#330099">Status Code: </font><b><
> > > > %# Eval("StatusCode")%></b></td>

>
> > > > <td><label runat="server" id="lbl"><font color="#330099">Pin:
> > > > </font><b><%#Eval("Pin")%></label></b></tr>
> > > > </ItemTemplate>
> > > > <SeparatorTemplate>
> > > > <tr>
> > > > <td colspan="100%"><hr size="1" color=#330099 /><br />

>
> > > > </td>
> > > > </tr>
> > > > </SeparatorTemplate>
> > > > <FooterTemplate>
> > > > </table>
> > > > </FooterTemplate>
> > > > </asp:Repeater>- Hide quoted text -

>
> > > - Show quoted text -

>
> > I want to put security on the page if the person has manager rights
> > they will have the Pin field visible.

>
> > So I will put something like:

>
> > If Session(CSI) = true then

>
> > the pin field is visible

>
> > else

>
> > the pin field in not visible

>
> > I hope that makes sense
> > I want the Pin field- Hide quoted text -

>
> > - Show quoted text -

>
> A little confused... like this:
>
> Function getPin(ByVal sPin)
>
> * * * * If Session(CSI) = True Then
> * * * * * * Return sPin.visible = False
>
> * * * * End If
> * * End Function- Hide quoted text -
>
> - Show quoted text -


Thanks George:

Here's my function:

Function getPin(ByVal sPin)


If Session("SPSListings") = True Then
Return sPin
Else
Return "you have no access"

End If


End Function

Then on the aspx page I have this but I'm getting Container is not
declared. Any suggestions?

<font color="#330099">Pin: </font><b><
%getPin(DataBinder.Eval(Container.DataItem, "Pin"))%></td></b></tr>

 
Reply With Quote
 
JJ297
Guest
Posts: n/a
 
      04-01-2008
On Apr 1, 10:58*am, JJ297 <(E-Mail Removed)> wrote:
> On Apr 1, 7:57*am, "George Ter-Saakov" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > The idea to output to browser Pin or nothing to the user if he does not have
> > permissions. It's a little different aproach than just hiding this column
> > which is in HTML word might be prefered way.

>
> > so in C# code it will be
> > protected string GetPin(string sPin)
> > {
> > * * * * if (Session("CSI") == true)
> > * * * * * * return sPin
> > * * * * else
> > * * * * * * return "*" //or anything you want

>
> > }

>
> > And on your page you have

>
> > <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>

>
> > This line will call your GetPin for every row and output sPin or *
> > depends on what is in Session("CSI")

>
> > George.

>
> > "JJ297" <(E-Mail Removed)> wrote in message

>
> >news:(E-Mail Removed)...
> > On Mar 31, 3:33 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:

>
> > > I see it now....
> > > The best way to do is following....
> > > in your code on the page make a function (C# example, but you should not
> > > have a problem to convert it to VB.NET)

>
> > > protected string GetPin(string sPin)
> > > {
> > > if( _iLevel > 1 )
> > > return sPin;
> > > else
> > > return "******";

>
> > > }

>
> > > in your aspx page instead of
> > > <%#Eval("Pin")%>
> > > have something like
> > > <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>

>
> > > Remember, Eval is the function and you always can create your own
> > > version.....

>
> > > George.

>
> > > "JJ297" <(E-Mail Removed)> wrote in message

>
> > >news:(E-Mail Removed)...
> > > On Mar 31, 2:52 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:

>
> > > > By hiding what exactly you mean???

>
> > > > Do it like <!--<%#Eval("Pin")%>--> and it will be hidden in a
> > > > browser....

>
> > > > Or how about not to have <%#Eval("Pin")%> at all? It will be really
> > > > hidden
> > > > then

>
> > > > George.

>
> > > > "JJ297" <(E-Mail Removed)> wrote in message

>
> > > >news:(E-Mail Removed)...

>
> > > > >I want to hide the Pin field below in my repeater. How do I do this?

>
> > > > > <asp:Repeater ID="Repeater1" runat="server"
> > > > > DataSourceID="SqlDataSource1">

>
> > > > > <ItemTemplate>
> > > > > <tr>
> > > > > <td><font color="#330099">Claim SSN: </font><b><%#
> > > > > Eval("ClaimSSN") %></b></td>
> > > > > <td colspan="2"></td>
> > > > > <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
> > > > > b></td>

>
> > > > > <td colspan="2"></td>

>
> > > > > <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
> > > > > Eval("BICSSN") %></b></td>

>
> > > > > <tr></tr>
> > > > > <td colspan="7"></td>

>
> > > > > <td colspan="7"><font color="#330099">Status Code: </font><b><
> > > > > %# Eval("StatusCode")%></b></td>

>
> > > > > <td><label runat="server" id="lbl"><font color="#330099">Pin:
> > > > > </font><b><%#Eval("Pin")%></label></b></tr>
> > > > > </ItemTemplate>
> > > > > <SeparatorTemplate>
> > > > > <tr>
> > > > > <td colspan="100%"><hr size="1" color=#330099 /><br />

>
> > > > > </td>
> > > > > </tr>
> > > > > </SeparatorTemplate>
> > > > > <FooterTemplate>
> > > > > </table>
> > > > > </FooterTemplate>
> > > > > </asp:Repeater>- Hide quoted text -

>
> > > > - Show quoted text -

>
> > > I want to put security on the page if the person has manager rights
> > > they will have the Pin field visible.

>
> > > So I will put something like:

>
> > > If Session(CSI) = true then

>
> > > the pin field is visible

>
> > > else

>
> > > the pin field in not visible

>
> > > I hope that makes sense
> > > I want the Pin field- Hide quoted text -

>
> > > - Show quoted text -

>
> > A little confused... like this:

>
> > Function getPin(ByVal sPin)

>
> > * * * * If Session(CSI) = True Then
> > * * * * * * Return sPin.visible = False

>
> > * * * * End If
> > * * End Function- Hide quoted text -

>
> > - Show quoted text -

>
> Thanks George:
>
> Here's my function:
>
> *Function getPin(ByVal sPin)
>
> * * * * If Session("SPSListings") = True Then
> * * * * * * Return sPin
> * * * * Else
> * * * * * * Return "you have no access"
>
> * * * * End If
>
> * * End Function
>
> Then on the aspx page I have this but I'm getting Container is not
> declared. *Any suggestions?
>
> <font color="#330099">Pin: </font><b><
> %getPin(DataBinder.Eval(Container.DataItem, "Pin"))%></td></b></tr>- Hide quoted text -
>
> - Show quoted text -


George I got it I left out the # in front of the GetPin. Thanks.

Another question for you. I have this in the function:
If Session("SPSListings") = True Then
Return sPin
Else
Return "you have no access"

End If

How can I get rid of the Pin column all together if the user doesn't
have access instead of returning "You have no Access" Can I make that
column visiable = false?

 
Reply With Quote
 
George Ter-Saakov
Guest
Posts: n/a
 
      04-01-2008
It's cause you missing #
Must be
<%# getPin(DataBinder.Eval(Container.DataItem, "Pin"))%>
----------------------------------------------------
Nothing is changed comparing
to <%#Eval("Pin")%>

The Eval("Pin") method is exactly same thing as
DataBinder.Eval(Container.DataItem, "Pin"))
It returns string during binding time... We just plugde getPing in between
to analyse permission and modify the string...

PS:
Also since getPin is called for every row it makes sence to move
Session("CSI") out of the loop (it's a look up in a hashtable done for every
row)..

So in your Page create member variable _bCSI = false and in OnLoad event
assign it _bCSI = (bool)Session("CSI") (sorry C# again)
the in getPin do If( _bCSI = True) ...... Saves a little of runtime....






George.


"JJ297" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Apr 1, 7:57 am, "George Ter-Saakov" <(E-Mail Removed)> wrote:
> The idea to output to browser Pin or nothing to the user if he does not
> have
> permissions. It's a little different aproach than just hiding this column
> which is in HTML word might be prefered way.
>
> so in C# code it will be
> protected string GetPin(string sPin)
> {
> if (Session("CSI") == true)
> return sPin
> else
> return "&nbsp;" //or anything you want
>
> }
>
> And on your page you have
>
> <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>
>
> This line will call your GetPin for every row and output sPin or &nbsp;
> depends on what is in Session("CSI")
>
> George.
>
> "JJ297" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Mar 31, 3:33 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > I see it now....
> > The best way to do is following....
> > in your code on the page make a function (C# example, but you should not
> > have a problem to convert it to VB.NET)

>
> > protected string GetPin(string sPin)
> > {
> > if( _iLevel > 1 )
> > return sPin;
> > else
> > return "******";

>
> > }

>
> > in your aspx page instead of
> > <%#Eval("Pin")%>
> > have something like
> > <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>

>
> > Remember, Eval is the function and you always can create your own
> > version.....

>
> > George.

>
> > "JJ297" <(E-Mail Removed)> wrote in message

>
> >news:(E-Mail Removed)...
> > On Mar 31, 2:52 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:

>
> > > By hiding what exactly you mean???

>
> > > Do it like <!--<%#Eval("Pin")%>--> and it will be hidden in a
> > > browser....

>
> > > Or how about not to have <%#Eval("Pin")%> at all? It will be really
> > > hidden
> > > then

>
> > > George.

>
> > > "JJ297" <(E-Mail Removed)> wrote in message

>
> > >news:(E-Mail Removed)...

>
> > > >I want to hide the Pin field below in my repeater. How do I do this?

>
> > > > <asp:Repeater ID="Repeater1" runat="server"
> > > > DataSourceID="SqlDataSource1">

>
> > > > <ItemTemplate>
> > > > <tr>
> > > > <td><font color="#330099">Claim SSN: </font><b><%#
> > > > Eval("ClaimSSN") %></b></td>
> > > > <td colspan="2"></td>
> > > > <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
> > > > b></td>

>
> > > > <td colspan="2"></td>

>
> > > > <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
> > > > Eval("BICSSN") %></b></td>

>
> > > > <tr></tr>
> > > > <td colspan="7"></td>

>
> > > > <td colspan="7"><font color="#330099">Status Code: </font><b><
> > > > %# Eval("StatusCode")%></b></td>

>
> > > > <td><label runat="server" id="lbl"><font color="#330099">Pin:
> > > > </font><b><%#Eval("Pin")%></label></b></tr>
> > > > </ItemTemplate>
> > > > <SeparatorTemplate>
> > > > <tr>
> > > > <td colspan="100%"><hr size="1" color=#330099 /><br />

>
> > > > </td>
> > > > </tr>
> > > > </SeparatorTemplate>
> > > > <FooterTemplate>
> > > > </table>
> > > > </FooterTemplate>
> > > > </asp:Repeater>- Hide quoted text -

>
> > > - Show quoted text -

>
> > I want to put security on the page if the person has manager rights
> > they will have the Pin field visible.

>
> > So I will put something like:

>
> > If Session(CSI) = true then

>
> > the pin field is visible

>
> > else

>
> > the pin field in not visible

>
> > I hope that makes sense
> > I want the Pin field- Hide quoted text -

>
> > - Show quoted text -

>
> A little confused... like this:
>
> Function getPin(ByVal sPin)
>
> If Session(CSI) = True Then
> Return sPin.visible = False
>
> End If
> End Function- Hide quoted text -
>
> - Show quoted text -


Thanks George:

Here's my function:

Function getPin(ByVal sPin)


If Session("SPSListings") = True Then
Return sPin
Else
Return "you have no access"

End If


End Function

Then on the aspx page I have this but I'm getting Container is not
declared. Any suggestions?

<font color="#330099">Pin: </font><b><
%getPin(DataBinder.Eval(Container.DataItem, "Pin"))%></td></b></tr>


 
Reply With Quote
 
JJ297
Guest
Posts: n/a
 
      04-01-2008
On Apr 1, 11:18*am, "George Ter-Saakov" <(E-Mail Removed)> wrote:
> It's cause you missing #
> Must be
> <%# getPin(DataBinder.Eval(Container.DataItem, "Pin"))%>
> ----------------------------------------------------
> Nothing is changed comparing
> to <%#Eval("Pin")%>
>
> The Eval("Pin") method is exactly same thing as
> DataBinder.Eval(Container.DataItem, "Pin"))
> It returns string during binding time... We just plugde getPing in between
> to analyse permission and modify the string...
>
> PS:
> Also since getPin is called for every row it makes sence to move
> Session("CSI") out of the loop (it's a look up in a hashtable done for every
> row)..
>
> So in your Page *create member variable _bCSI = false and in OnLoad event
> assign it _bCSI = (bool)Session("CSI") (sorry C# again)
> the in getPin do If( _bCSI = True) ...... Saves a little of runtime....
>
> George.
>
> "JJ297" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Apr 1, 7:57 am, "George Ter-Saakov" <(E-Mail Removed)> wrote:
>
>
>
>
>
> > The idea to output to browser Pin or nothing to the user if he does not
> > have
> > permissions. It's a little different aproach than just hiding this column
> > which is in HTML word might be prefered way.

>
> > so in C# code it will be
> > protected string GetPin(string sPin)
> > {
> > if (Session("CSI") == true)
> > return sPin
> > else
> > return "&nbsp;" //or anything you want

>
> > }

>
> > And on your page you have

>
> > <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>

>
> > This line will call your GetPin for every row and output sPin or &nbsp;
> > depends on what is in Session("CSI")

>
> > George.

>
> > "JJ297" <(E-Mail Removed)> wrote in message

>
> >news:(E-Mail Removed)...
> > On Mar 31, 3:33 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:

>
> > > I see it now....
> > > The best way to do is following....
> > > in your code on the page make a function (C# example, but you should not
> > > have a problem to convert it to VB.NET)

>
> > > protected string GetPin(string sPin)
> > > {
> > > if( _iLevel > 1 )
> > > return sPin;
> > > else
> > > return "******";

>
> > > }

>
> > > in your aspx page instead of
> > > <%#Eval("Pin")%>
> > > have something like
> > > <%# GetPin((string)DataBinder.Eval(Container.DataItem, "Pin"))%>

>
> > > Remember, Eval is the function and you always can create your own
> > > version.....

>
> > > George.

>
> > > "JJ297" <(E-Mail Removed)> wrote in message

>
> > >news:(E-Mail Removed)...
> > > On Mar 31, 2:52 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:

>
> > > > By hiding what exactly you mean???

>
> > > > Do it like <!--<%#Eval("Pin")%>--> and it will be hidden in a
> > > > browser....

>
> > > > Or how about not to have <%#Eval("Pin")%> at all? It will be really
> > > > hidden
> > > > then

>
> > > > George.

>
> > > > "JJ297" <(E-Mail Removed)> wrote in message

>
> > > >news:(E-Mail Removed)...

>
> > > > >I want to hide the Pin field below in my repeater. How do I do this?

>
> > > > > <asp:Repeater ID="Repeater1" runat="server"
> > > > > DataSourceID="SqlDataSource1">

>
> > > > > <ItemTemplate>
> > > > > <tr>
> > > > > <td><font color="#330099">Claim SSN: </font><b><%#
> > > > > Eval("ClaimSSN") %></b></td>
> > > > > <td colspan="2"></td>
> > > > > <td><font color="#330099">BIC: </font><b><%# Eval("BIC") %></
> > > > > b></td>

>
> > > > > <td colspan="2"></td>

>
> > > > > <td colspan="2"><font color="#330099">BIC SSN: </font><b><%#
> > > > > Eval("BICSSN") %></b></td>

>
> > > > > <tr></tr>
> > > > > <td colspan="7"></td>

>
> > > > > <td colspan="7"><font color="#330099">Status Code: </font><b><
> > > > > %# Eval("StatusCode")%></b></td>

>
> > > > > <td><label runat="server" id="lbl"><font color="#330099">Pin:
> > > > > </font><b><%#Eval("Pin")%></label></b></tr>
> > > > > </ItemTemplate>
> > > > > <SeparatorTemplate>
> > > > > <tr>
> > > > > <td colspan="100%"><hr size="1" color=#330099 /><br />

>
> > > > > </td>
> > > > > </tr>
> > > > > </SeparatorTemplate>
> > > > > <FooterTemplate>
> > > > > </table>
> > > > > </FooterTemplate>
> > > > > </asp:Repeater>- Hide quoted text -

>
> > > > - Show quoted text -

>
> > > I want to put security on the page if the person has manager rights
> > > they will have the Pin field visible.

>
> > > So I will put something like:

>
> > > If Session(CSI) = true then

>
> > > the pin field is visible

>
> > > else

>
> > > the pin field in not visible

>
> > > I hope that makes sense
> > > I want the Pin field- Hide quoted text -

>
> > > - Show quoted text -

>
> > A little confused... like this:

>
> > Function getPin(ByVal sPin)

>
> > If Session(CSI) = True Then
> > Return sPin.visible = False

>
> > End If
> > End Function- Hide quoted text -

>
> > - Show quoted text -

>
> Thanks George:
>
> Here's my function:
>
> *Function getPin(ByVal sPin)
>
> * * * * If Session("SPSListings") = True Then
> * * * * * * Return sPin
> * * * * Else
> * * * * * * Return "you have no access"
>
> * * * * End If
>
> * * End Function
>
> Then on the aspx page I have this but I'm getting Container is not
> declared. *Any suggestions?
>
> <font color="#330099">Pin: </font><b><
> %getPin(DataBinder.Eval(Container.DataItem, "Pin"))%></td></b></tr>- Hide quoted text -
>
> - Show quoted text -


Okay don't quite understand what you want me to do. I added this to
page load:

Dim _bCSI=(bool)Session("CSI")

Getting error message end of statement expected

Then added this:

Function getPin(ByVal sPin)

If (_BCSI = True) Then

Return "you have no access"

End If


End Function

Getting _BCSI is not declared. Any suggestions? Thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
Script for Hiding/Un-Hiding Text On Click Ste Javascript 41 08-01-2007 02:35 PM
Showing/Hiding a Panel in a Repeater Kevin Humphreys ASP .Net Web Controls 1 11-10-2006 10:06 PM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
Hiding a field from Auto-Complete Ed Light HTML 2 10-03-2005 06:20 AM



Advertisments