|
Hello
i have a asp.net application with subfolder:
www.myapplication.com/ressourcefolder/
I have disable anonymous access to ressourcefolder in IIS, If i try to access to this folder in internet explorer i have the authentication window.
Now i want my website to access to this folder witout opening the authentication window on client side.
How do this?
Thanks
|
|
|
|
|
enable integrated security on the folder.
make sure the windows account has access to the folder.
Add the site to the trusted sites list on the client.
I didn't get any requirements for the signature
|
|
|
|
|
|
If you want to suppress the authentication window at client it can be done through clients browser settings Tools--> Internet Options --> Security and select the zone of your site ie if client is accessing your site through intranet then select intranet and click on Custom Level Button and scroll down the list to Authentication and under logon select autiomatically login in intranet zone.
However these settings are to be made at client machine I belive there is nothing that can be done for it at server side
Shujaat
|
|
|
|
|
I am attempting to port an asp site which uses reference to wsc files; for example
objMyObject = Server.CreateObject("MyFile.WSC");
over to c#/net, how do I use the existing wsc file from .net?
I have already looked at using tlbImp.exe to affect a com iterop, but this produced an error.
Thanks
|
|
|
|
|
I grabbed the gridview control onto design page and then binded it with the database. Now I want to enter data in the grid view when i run the website but i cannot find the way to do that. How can this be done? Any guidance please or show me the code or way to do that.
Thanks
|
|
|
|
|
Be more clear, you mean, that your gridview read well the data from the database, but you can't add new records?
did you bind the gridwiew to a sqlDataSource?
|
|
|
|
|
yes i can see the data which has been added from SQL Server DB but how I can add manually?
Yes I binded gridview to SQL Data Source.
|
|
|
|
|
ok, when you bind the sqlDatasource. if you want enable edit and adding, you have to make when you are configuring the sqldatasource, in the box you select the columns you want to show from the database, there are three botton, Where, orden by and Advanced click the last one, Advanced, and check the first box "generate inset up........
and bind again your grid view to the sqldatasource.
and play with the grid view setting to make enable edit and adding.
hope that will help
|
|
|
|
|
I can see edit option but no ADD option. How can this be done?
|
|
|
|
|
|
I am trying to create a GridView with TextBoxes in the header that will allow searches. Here is the GridView:
<asp:GridView ID="gvSearchResults" runat="server" AutoGenerateColumns="false" EmptyDataText="No Records Found" OnRowCommand="gvSearchResults_RowCommand" ShowHeader="true">
<Columns>
<asp:BoundField DataField="CustomerCode" Visible="false" />
<asp:BoundField DataField="CardNumber" HeaderText="Card Number"/>
<asp:BoundField DataField="FirstName" HeaderText="First Name"/>
<asp:BoundField DataField="MiddleInitial" HeaderText="Initial"/>
<asp:BoundField DataField="LastName" HeaderText="Last Name"/>
<asp:BoundField DataField="Address" HeaderText="Street"/>
<asp:BoundField DataField="City" HeaderText="City"/>
<asp:BoundField DataField="State" HeaderText="State"/>
<asp:BoundField DataField="ZipCode" HeaderText="Zip Code"/>
<asp:TemplateField>
<HeaderTemplate>
<asp:Button id="cmdSearch" CommandName="Search" Text="Search" runat="server"/>
</HeaderTemplate>
<ItemTemplate>
<asp:Button id="cmdViewActivity" Text="Activity" CommandName="Activity" CommandArgument="CustomerCode" runat="server" />
<asp:Button id="cmdViewDetails" Text="Details" CommandName="Details" CommandArgument="CustomerCode" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Here is the code I am using to add a Label and TextBox to the header in Page_Load (when it is not a PostBack):
Label lblSearchCardNumber = new Label();
lblSearchCardNumber.Text = "Card Number<br />";
lblSearchCardNumber.CssClass = "headerlabel";
gvSearchResults.HeaderRow.Cells[1].Controls.Add(lblSearchCardNumber);
TextBox txtSearchCardNumber = new TextBox();
txtSearchCardNumber.Columns = 11;
txtSearchCardNumber.MaxLength = 11;
txtSearchCardNumber.CssClass = "headertextbox";
gvSearchResults.HeaderRow.Cells[1].Controls.Add(txtSearchCardNumber);
Everything works fine at this point (although I had to create a dummy DataSet to get the GridView to display initially). When the Search button is clicked I want to retrieve the values from the textboxes in the header to use as my search parameters. For some reason I cannot access the HeaderRow. What exactly am I doing wrong? I can access the Row information but not the HeaderRow?
protected void gvSearchResults_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Search")
{
string searchCardNumber = "";
GridViewRow gvRow = gvSearchResults.HeaderRow;
searchCardNumber = ((TextBox)gvRow.FindControl("txtSearchCardNumber")).Text;
}
}
|
|
|
|
|
You have to recreated Lable and Textboxe in headertemplate when u click on button
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
So when I add the TextBoxes they are lost during the postback? Is there any other way I can add them to make them persistant? I guess if there is not another way I will just remove them from the GridView. Thanks for your time.
|
|
|
|
|
You have to recreate controls in header template before using them.
but y u created at runtime?
best Regard
pathan
---------------------------------------------------
|
|
|
|
|
I created them at runtime because that was the only way I could figure out to create them and still use BoundFields. I assumed once they were created they would be persistant. I guess I could use ItemTemplates and HeaderTemplates for each field instead. Is there any reason not to use them instead of BoundFields? Thanks for your help. I am new to 2.0 and still trying to figure things out.
Edit: I just used code below and I can now access the value in the TextBox. Thanks for steering me in the right direction!
<asp:TemplateField>
<HeaderTemplate>
<asp:TextBox ID="txtCardNumber" Columns="11" MaxLength="11" runat="server"></asp:TextBox>
</HeaderTemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "CardNumber")%>
</ItemTemplate>
</asp:TemplateField>
-- modified at 8:29 Thursday 6th September, 2007
|
|
|
|
|
you mean to say ((TextBox)gvRow.FindControl("txtSearchCardNumber")).Text; is returning null ?
|
|
|
|
|
Yes.
divyesh1432 wrote: you mean to say ((TextBox)gvRow.FindControl("txtSearchCardNumber")).Text; is returning null ?
|
|
|
|
|
Hi all.
I have a C# ASP.NET project. I have a user control which utilises ajax for its functionality.
The usercontrol has 3 links that should display something above it when clicked. This part does not work on my PC. The EXACT same project that runs on my team mate's PC works fine. The usercontrols link events fire and display properly on his side.
Is there some sort of setting/option I am missing somewhere?
I have the !DOCTYPE declaration on my container form.
Please assist.
Thanks
M
|
|
|
|
|
The browser and browser setting from your machine and your team mate's PC are the same??
Show us the code that doesn't work in your machine and what error you are getting?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Yes the setting are the same.
There is no error, the link that should display things, is not working at all.
I have 3 hyperlinks alongside each other, the link that is clicked should change colour so that it's different to the other 2 and display text within the user control.
I doubt there is anything wrong with the code, as it works on our test server and my team mate's PC, except on mine. I ran a sample ajax project that i downloaded, and that works on my PC.
It does not work in firefox as well. What else am i missing?
This is the usercontrol's .cs file:
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Collections;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
<br />
public partial class UserControl_tabcontrol : System.Web.UI.UserControl<br />
{<br />
#region " Variables "<br />
protected string color1 = string.Empty;<br />
protected string color2 = string.Empty;<br />
protected string color3 = string.Empty;<br />
#endregion<br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
}<br />
<br />
#region " Section used to display selected content "<br />
protected void lbContent_Click(object sender, EventArgs e)<br />
{<br />
lblMessage.Text = ConfigurationManager.AppSettings["TabControlMessage"];<br />
litDisplayCategory1.Text = string.Empty;<br />
LinkButton lb = sender as LinkButton;<br />
switch (lb.CommandArgument as string)<br />
{<br />
case "1":<br />
litDisplayCategory1.Text = GDDataAccess.DisplayTabArticle(ConfigurationManager.AppSettings["Content1"]).ToString();<br />
color1 = ConfigurationManager.AppSettings["ColorTabControlSelected_#cc99ff"];<br />
color2 = ConfigurationManager.AppSettings["ColorTabControlNotSelected_#9400a3"];<br />
color3 = ConfigurationManager.AppSettings["ColorTabControlNotSelected_#9400a3"];<br />
break;<br />
case "2":<br />
litDisplayCategory1.Text = GDDataAccess.DisplayTabArticle(ConfigurationManager.AppSettings["Content2"]).ToString();<br />
color1 = ConfigurationManager.AppSettings["ColorTabControlNotSelected_#9400a3"];<br />
color2 = ConfigurationManager.AppSettings["ColorTabControlSelected_#cc99ff"];<br />
color3 = ConfigurationManager.AppSettings["ColorTabControlNotSelected_#9400a3"];<br />
break;<br />
case "3":<br />
litDisplayCategory1.Text = GDDataAccess.DisplayTabArticle(ConfigurationManager.AppSettings["Content3"]).ToString();<br />
color1 = ConfigurationManager.AppSettings["ColorTabControlNotSelected_#9400a3"];<br />
color2 = ConfigurationManager.AppSettings["ColorTabControlNotSelected_#9400a3"];<br />
color3 = ConfigurationManager.AppSettings["ColorTabControlSelected_#cc99ff"];<br />
break;<br />
default:<br />
break;<br />
}<br />
}<br />
#endregion<br />
<br />
#region " Public properties "<br />
public void LoadContent(string arg1,string arg2)<br />
{<br />
lbContent_Click(lbContent1, new System.Web.UI.WebControls.CommandEventArgs(arg1, arg2));<br />
}<br />
<br />
public void ShowHideTabControl(bool bValue)<br />
{<br />
if (bValue)<br />
pnlTabControl.Visible = true;<br />
}<br />
#endregion<br />
}
And this is the usercontrol's designer source:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile = "~/UserControl/tabcontrol.ascx.cs" Inherits = "UserControl_tabcontrol" %><br />
<br />
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"<br />
Namespace="System.Web.UI" TagPrefix="asp" %><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<asp:UpdatePanel ID="ajaxDisplayContent" runat="server"><br />
<ContentTemplate><br />
<asp:Panel ID="pnlTabControl" runat="server" Visible="false"><br />
<table border="0" cellpadding="0" cellspacing="0" width="458px" style="height:160px"><br />
<tr><br />
<td colspan="2" style="font-weight: bold;text-transform: uppercase;text-indent:10px;height:30px;text-align:left;background-color:#669966;font-size:8pt"><br />
<asp:Label ID="lblMessage" runat="server" ForeColor="white"></asp:Label><br />
</td><br />
</tr><br />
<tr><br />
<td><br />
<table border="0" cellpadding="0" cellspacing="0" width="100%"><br />
<tr><br />
<td colspan="3" style="background-color:#bbbbbb;color:White;text-align:left;"><br />
<table border="0" cellpadding="5" cellspacing="5" width="100%" style="width:230px;height:130px;"><br />
<tr><br />
<td style="background-color:#bbbbbb;"><br />
<asp:Literal ID="litDisplayCategory1" runat="server"></asp:Literal> <br />
</td><br />
</tr><br />
</table> <br />
</td><br />
</tr><br />
</table> <br />
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="height:30px;"> <br />
<tr><br />
<td style="text-align:center;background-color: <%= color1%>;"><br />
<asp:LinkButton ID="lbContent1" style="text-decoration:none;" runat="server" CommandName="Content1" CommandArgument="1" OnClientClick="" OnClick="lbContent_Click"><div style="FONT-SIZE: 12pt; color: #ffffff;font-weight: bold;"> 1 </div></asp:LinkButton><br />
</td><br />
<td style="text-align:center;background-color: <%= color2%>;"><br />
<asp:LinkButton ID="lbContent2" style="text-decoration:none;" runat="server" CommandName="Content2" CommandArgument="2" OnClientClick="" OnClick="lbContent_Click"><div style="FONT-SIZE: 12pt; color: #ffffff;font-weight: bold;"> 2 </div></asp:LinkButton><br />
</td><br />
<td style="text-align:center;background-color: <%= color3%>;"><br />
<asp:LinkButton ID="lbContent3" style="text-decoration:none;" runat="server" CommandName="Content3" CommandArgument="3" OnClientClick="" OnClick="lbContent_Click"><div style="FONT-SIZE: 12pt; color: #ffffff;font-weight: bold;"> 3 </div></asp:LinkButton><br />
</td><br />
</tr><br />
</table> </td><br />
<td><br />
<table border="0" cellpadding="0" cellspacing="0" width="100%"><br />
<tr><br />
<td style="width:230px;height:130px;"><br />
<img src="../images/FreeNews.jpg" alt="" id="imgTabControl"/> <br />
</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
<tr><br />
<td colspan="2"><br />
<div style="FONT-SIZE: 6px; color: #ffffff;"> </div><br />
</td><br />
</tr><br />
</table><br />
</asp:Panel><br />
</ContentTemplate> <br />
</asp:UpdatePanel>
|
|
|
|
|
Sorry the usercontrol's source was not complete:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile = "~/UserControl/tabcontrol.ascx.cs" Inherits = "UserControl_tabcontrol" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:updatepanel id="ajaxDisplayContent" runat="server">
<contenttemplate>
<asp:panel id="pnlTabControl" runat="server" visible="false">
<asp:label id="lblMessage" runat="server" forecolor="white">
|
<asp:literal id="litDisplayCategory1" runat="server">
|
|
<asp:linkbutton id="lbContent1" style="text-decoration:none;" runat="server" commandname="Content1" commandargument="1" onclientclick="" onclick="lbContent_Click"> 1
|
<asp:linkbutton id="lbContent2" style="text-decoration:none;" runat="server" commandname="Content2" commandargument="2" onclientclick="" onclick="lbContent_Click"> 2
|
<asp:linkbutton id="lbContent3" style="text-decoration:none;" runat="server" commandname="Content3" commandargument="3" onclientclick="" onclick="lbContent_Click"> 3
|
|
|
|
|
|
|
|
|
Need help. I am trying to add a hyperlinkfield dynamically to a grid view , that works fine until i want to pass a parameter to the string, i get this error
BC30311: Value of type 'String' cannot be converted to '1-dimensional array of String'.
this is the code,
<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br />
SqlDataSource1.SelectCommand = "SELECT * FROM [products]"<br />
GridView1.DataKeyNames = "pid"<br />
Dim lnk As HyperLinkField<br />
lnk = New HyperLinkField<br />
lnk.DataTextField = "pname"<br />
lnk.NavigateUrl = "home.aspx"<br />
lnk.DataNavigateUrlFields = "pid"<br />
<br />
End Sub<br />
<
<br />
asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" EnableViewState="false"><br />
<Columns><br />
<br />
</Columns><br />
</asp:GridView><br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:vpx_newConnectionString %>"<br />
></asp:SqlDataSource><br />
|
|
|
|
|
Dim x As String() = New String(0) {}
x(0) = "pid"
lnk.DataNavigateUrlFields = x(0)
I didn't get any requirements for the signature
|
|
|
|
|
thank you so much for taking the time to answer, but still not working, i can't believe, i put the code this way
Dim lnk As HyperLinkField<br />
lnk = New HyperLinkField<br />
lnk.DataTextField = "pname"<br />
lnk.NavigateUrl = "home.aspx"<br />
lnk.DataNavigateUrlFormatString = "~/home.aspx?pid={0}"<br />
Dim x As String() = New String(0) {}<br />
x(0) = "pid"<br />
lnk.DataNavigateUrlFields = x(0)<br />
and still, over the last line on x(0) still have the message that says
value of type 'string'cannot be converted to '1 dimensional array of string'
|
|
|
|