|
Dear ALL,
I am preparing a ASP.NET based project in C# language and there is a treeview on masterpage.So i want to disable some subnodes of the tree at run time according to the user rights given to logged in user.
Please reply as soon as possible.
|
|
|
|
|
if you use Treeview for menu , then i thing based to use "Menu" with master pages insted of Tree view.
|
|
|
|
|
i want to get the date in txtbox of gridview thru pop up calender
could u plz suggest ancode for it.
i do not know where to bind date frm calender and how to get the textbox fron gridview to bind the date.
with regards
n.priya
priya
|
|
|
|
|
use FindControl methods .
|
|
|
|
|
Hi...
I want to Import or Read contacts from Mail Clients like Yahoo,Gmail,AOL,Rediff and hotmail.we have downloaded some code from ideabubbling and tried it, but some times it is not working for some account's in rediff,Hotmail,AOL.in
will the maildomain's constantly change the session or links which are hardcoded in the downloaded code. PlZ help me.....
|
|
|
|
|
|
<asp:gridview runat="server" id="gridview1" visible="true">
AutoGenerateColumns="false"
Font-Bold="true"
ForeColor="#003300" OnRowDataBound="gridview1_RowDataBound"
Width="186px" OnSelectedIndexChanged="gridview1_SelectedIndexChanged" OnRowCreated="gridview1_RowCreated">
<columns> <asp:commandfield showselectbutton="True">;
<asp:boundfield datafield="Name" headertext="Name">
InsertVisible="False" ReadOnly="True" SortExpression="Name" >
<asp:boundfield datafield="ID" headertext="ID">
SortExpression="ID" >
<asp:templatefield headertext="select">
<itemtemplate><asp:checkbox id="chk1" runat="server">
<asp:button id="Button1" runat="server" onclick="Button1_Click">
code behind for getting selected checkbox herere iam not able to get the checked rows.plz find an solution
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in gridview1.Rows)
{
DataTable dt=new DataTable();
dt.Columns.Add(new DataColumn("Name", typeof(string)));
dt.Columns.Add(new DataColumn("ID", typeof(string)));
CheckBox Check = (CheckBox)row.Cells[3].FindControl("chk1");
if (Check.Checked)
{
dt.Rows.Add();
dt.Rows.Add(row);
}
}
}
find a solution to get the checked rows in gridview
with regards
n.priya
priya
|
|
|
|
|
try this,
string checkedrows=""+request.Form["CheckboxId"];
if ur checkbox is inside a gridview and it is a Inputype.
|
|
|
|
|
Use GridViewRow , set the selected rows to that new gridview row, now you can use it any other gridview on that page. For any other page use Session .
|
|
|
|
|
Hi. I am working on a project in which I am using an Http Handler to display the images. Can anybody tell me how can we use this handler in the rowdatabound event of a gridview in stead of simply binding the url "" in the template field of the grid view ?? Also can anybody tell me how to pass the corresponding row index of the rows in the gridview to the handler ???
Thanks & regards,
S Mohapatra
Soumyakanta
|
|
|
|
|
Hi All
I am dynamically creating some dropdownlist in the TextBox textchanged event and placing them in a placeholder. Now I want to retrieve all the dropdowns selected value to be inserted into the DB when i press save button. But the problem is that when I press save my place holder gets empty and there is no drop down. How can I do that. I hope I am making sense. Please please help me.....
Sagar Pattnayak
Software Developer
Sun-Dew Solutions
+91-9831169962
|
|
|
|
|
where did you write the code for add the content ?
could you put you code over here ?
|
|
|
|
|
Here is the complete code listing.
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["MyCon"]);
protected void txtdeptnos_TextChanged(object sender, EventArgs e)
{
plcHolder.Controls.Clear();
for (int i = 1; i <= Convert.ToInt32(txtdeptnos.Text); i++)
{
DropDownList ddl = new DropDownList();
ddl.ID = "ddl" + i.ToString();
ddl.AppendDataBoundItems = true;
ddl.Items.Clear();
ddl.Items.Add("Select Department");
ddl.Width = 130;
ddl.Items[0].Value = "0";
string strfac = "select deptid,deptname from department where bitDeletedFlag=0";
con.Open();
DataSet ds1 = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(strfac, con);
da.Fill(ds1, "department");
ddl.DataSource = ds1.Tables["department"];
ddl.DataTextField = "deptname";
ddl.DataValueField = "deptid";
ddl.DataBind();
con.Close();
plcHolder.Controls.Add(ddl);
plcHolder.Controls.Add(new LiteralControl(" "));
plcHolder.Controls.Add(new LiteralControl(" "));
}
}
protected void BtnSave_Click(object sender, EventArgs e)
{
foreach (Control control in this.plcHolder.Controls)
{
if (control.GetType().Name == "DropDownList")
{
DropDownList dd = (DropDownList)control;
depts = depts + ", " + dd.SelectedItem.ToString();
//I want to concartinate all the selected values of the drop downs and to be inserted into the DB at this click function. But the place holder gets empty. This loop is not executing totally.
Session["val"] = dd.SelectedItem.ToString();
}
}
}
Sagar Pattnayak
Software Developer
Sun-Dew Solutions
+91-9831169962
|
|
|
|
|
I am trying to use the following code to ping GoogleBlog but it is taking FOREEEEVER to load. Can anyone see any issue with the code that may be causing it to run so incredibly slow? I am at my wits end with this now so any help appreciated.
Thank
------pingblog.aspx----------
<title>Untitled Page
<asp:button id="Button1" runat="server" text="Button">
<asp:label id="lb_display" runat="server" text="">
Hello world
-------pingmyblog.vb------------
Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Xml
Public Class _pingmyblog
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Write(Send())
End Sub
Function Send()
Dim listToPing As New ArrayList
Dim pingURL As String = ""
Dim blogURL As String = "http://www.eyeonspain.com/blogs/lisa.aspx"
Dim blogName As String = "Confessions of a Property Manager"
Dim blogFeed As String = "http://www.eyeonspain.com/blogs/feeds/lisa.xml"
With listToPing
.Add("http://blogsearch.google.com/ping/RPC2")
End With
Dim ok As String = ""
Dim NG As String = ""
Try
pingURL = listToPing.Item(i).ToString
Dim technoratiPing As HttpWebRequest = CType(WebRequest.Create(pingURL), HttpWebRequest)
technoratiPing.Method = "POST"
technoratiPing.ContentType = "text/xml"
Dim streamPingRequest As Stream = CType(technoratiPing.GetRequestStream, Stream)
Dim xmlPing As XmlTextWriter = New XmlTextWriter(streamPingRequest, System.Text.Encoding.UTF8)
xmlPing.Formatting = Formatting.Indented
xmlPing.WriteStartDocument()
xmlPing.WriteStartElement("methodCall")
xmlPing.WriteElementString("methodName", "weblogUpdates.ping")
xmlPing.WriteStartElement("params")
xmlPing.WriteStartElement("param")
xmlPing.WriteElementString("value", blogName)
xmlPing.WriteEndElement()
xmlPing.WriteStartElement("param")
xmlPing.WriteElementString("value", blogURL)
xmlPing.WriteEndElement()
xmlPing.WriteStartElement("param")
xmlPing.WriteElementString("value", blogURL)
xmlPing.WriteEndElement()
xmlPing.WriteStartElement("param")
xmlPing.WriteElementString("value", blogFeed)
xmlPing.WriteEndElement()
xmlPing.WriteEndElement()
xmlPing.WriteEndElement()
xmlPing.WriteEndDocument()
xmlPing.Flush()
Dim technoratiPingResponse As HttpWebResponse = CType(technoratiPing.GetResponse, HttpWebResponse)
Dim streamPingResponse As StreamReader = New StreamReader(technoratiPingResponse.GetResponseStream)
Dim strResult As String = streamPingResponse.ReadToEnd
streamPingResponse.Close()
technoratiPingResponse.Close()
ok = ok & strResult & " "
Catch ex As Exception
'Add code here to flag a service as broken
NG = NG & CStr(i) & " "
End Try
Next
Return "OK = " & ok & " " & "NG = " & NG
End Function
End Class
|
|
|
|
|
I have solved this now.
It's because I missed out "xmlPing.Close()"
Just thought I'd update this if anyone ever needs the code.
|
|
|
|
|
Hi all,
how to Bind the Custom Validator control to GridView Control.
please explain with example.
thanks in advance.
Jack
|
|
|
|
|
Do you mean you have a template field and you want to put a required validator on that?
|
|
|
|
|
yes, i have Template field,and item template, in item template, i have to keep "Custom Validator ", please explain me, with example.
Jack
|
|
|
|
|
Hi
I am displaying a password field which is part of the login control
However when I start typing in it, it is not showing the text being typed. Normally a circle appears in the textbox for each letter but for mine it is not displaying any text.
The text is still being entered as when I hit enter the page logs in and matches the password.
If any1 knows why this would let me know!
cheers!
|
|
|
|
|
Strange. Looks like some CSS issue. If you have applied CSS to the control, try removing it.
|
|
|
|
|
Your right it is sort of a css issue
Basically I'm including a skin in the page and I have the below code in it:
<asp:Textbox runat="server"
ForeColor="Black"
Font-Names="HelveticaNeueLT Std,Arial,Times New Roman,Verdana"
Font-Size="10pt"/>
but when I change Font-names to Font-family all the text is displayed in the wrong font
Is there something I can add in the above code so that it allows visible typing into a password box?
thanks!
|
|
|
|
|
sorted it
I gave the control an ID in the skin and then applied the ID to the password textbox
cheers!
|
|
|
|
|
|
It's the first time I'm dealing with programming a web service. I want to write a method that allows the client to download some files. I created a new folder called 'myFiles' in the Web Service solution.
The web method is this:
[WebMethod]
public byte[] downloadFile()
{
FileStream fs = new FileStream("myFiles\\aaa.txt", FileMode.Open);
byte[] contents = new byte[fs.Length];
fs.Read(contents, 0, (int)fs.Length);
return contents;
}
When I test the function, I get the error:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\myFiles\aaa.xls'.
Why is it looking fot the myFiles folder there. How do I point it to the local folder of the web service application?
Thanks.
|
|
|
|
|
Use Server.MapPath()
[WebMethod]
public byte[] downloadFile()
{
FileStream fs = new FileStream(Server.MapPath(@"myFiles/aaa.txt"), FileMode.Open);
byte[] contents = new byte[fs.Length];
fs.Read(contents, 0, (int)fs.Length);
return contents;
} myFiles directory should be in the root of WS. Make sure you are closing stream after reading.
|
|
|
|