|
How to resolve this problem ?
I had gave permission to machinkey folder, but no help.
Eventhough I register framework with IIS again.
Thanks,
Sun Rays
|
|
|
|
|
YOu might be better off in the ASP.NET forum.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Hi
I have a gridview in an aspx page.
The paging is working. But the sorting doesnot..It goes into an infinite loop..
Could you tell me what is going wrong..
Do I need to bind the datagrid after the sort function is called....
I couldn't find a correct answer so far ..
So please let me know the exact problem with this code.
Thank you
The following is the code
<asp:GridView ID="dg" runat="server" AutoGenerateColumns="false" AllowSorting="true" AllowPaging="True" OnSorting="dg_Sorting" OnPageIndexChanging="dg_PageIndexChanging" Width="447px">
<columns>
<asp:boundfield datafield="jobid" HeaderText="JOBID" SortExpression="jobid" />
<asp:boundfield datafield="jobpost" headertext="JOB NAME" SortExpression="jobpost" />
<asp:boundfield datafield="description" headertext="DESCRIPTION" SortExpression="description" />
<asp:boundfield datafield="nocondition" headertext="NO: OF CONDITIONS" SortExpression="nocondition" />
</columns>
</asp:GridView>
And I have the code for onSorting=dg_Sorting as follows
public partial class jobdetails : System.Web.UI.Page
{
SqlCommandBuilder c;
SqlDataAdapter da1;
DataSet ds1;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection ctr = new SqlConnection("data source =.\\SQLEXPRESS; initial Catalog=udus;user id=sa;password=pass123");
da1 = new SqlDataAdapter("select* from JOBMASTER", ctr);
ctr.Open();
c = new SqlCommandBuilder(da1);
ds1 = new DataSet();
da1.Fill(ds1, "JOBMASTER");
dg.DataSource = ds1;
dg.DataBind();
}
public void DataBind1()
{
SqlConnection ctr = new SqlConnection("data source =.\\SQLEXPRESS; initial Catalog=udus;user id=sa;password=pass123");
da1 = new SqlDataAdapter("select* from JOBMASTER", ctr);
ctr.Open();
c = new SqlCommandBuilder(da1);
ds1 = new DataSet();
da1.Fill(ds1, "JOBMASTER");
dg.DataSource = ds1;
}
public void dg_Sorting(object sender,GridViewSortEventArgs e)
{
string oldexpression = dg.SortExpression;
string newexpression = e.SortExpression;
if (oldexpression.IndexOf(newexpression) < 0)
{
if (oldexpression.Length > 0)
{
e.SortExpression = newexpression + "," + oldexpression;
}
else
{
e.SortExpression = newexpression;
}
}
else
{
e.SortExpression = oldexpression;
}
SortDirection direction;
direction = SortDirection.Ascending;
dg.Sort(e.SortExpression, direction);
}
protected void dg_PageIndexChanging(object source, GridViewPageEventArgs e)
{
DataBind1();
dg.PageIndex = e.NewPageIndex;
dg.DataBind();
}
}
|
|
|
|
|
Hi,
U cant set sorting like this.
U have to rete one function in that U can use dataview.
public void fillData(string sortExp)
{
if (Session["dv"] != null)
{
dv = (DataView)Session["dv"];
}
else
{
DataSet ds = new DataSet();
/// GET DATASET VALUE FROM YOUR FUNCTION
dv = new DataView();
dv.Table = ds.Tables[0];
}
dv.Sort = sortExp;
//// BIND DATAVIEW TO GRIDVIEW
}
Call this function from GridView sorting event.
if (ViewState["sort"] != null)
{
if ((SortDirection)ViewState["sort"] == SortDirection.Ascending)
{
ViewState["sort"] = SortDirection.Descending;
fillData(e.SortExpression.ToString() + " asc");
}
else
{
ViewState["sort"] = SortDirection.Ascending;
fillData(e.SortExpression.ToString() + " desc");
}
}
else
{
if (e.SortDirection == SortDirection.Ascending)
{
ViewState["sort"] = SortDirection.Descending;
fillData(e.SortExpression.ToString() + " asc");
}
else
{
ViewState["sort"] = SortDirection.Ascending;
fillData(e.SortExpression.ToString() + " desc");
}
}
Thanks,
Sun Rays
|
|
|
|
|
I want to insert text in gridview but i dont have any data source. How can I insert text values in dataGridview? for example if i want to insert value in textbox i will user textBox1.text="Adfsr" like in the same way i want to create a gridview i have two columns viz Name and description in datagridview and I want to insert in "Arun" in name field and "Healthy person" in description. please suggest.
I want to use dataGridview only....
Arun Singh
Noida.
|
|
|
|
|
First You should take 2 textboxes and one button..
then write the following code Globally....
static DataSet ds = new DataSet();
static DataTable dt=new DataTable();
and in pageload event you should paste this code
if(!IsPostBack)
{
dt.Columns.Clear();
ds.Clear();
dt.Rows.Clear();
dt.Columns.Add("Name");
dt.Columns.Add("Number");
ds.Tables.Clear();
ds.Tables.Add(dt);
DataGrid1.DataSource =ds;
DataGrid1.DataBind();
}
and Write code for button1..
DataRow r=dt.NewRow();
r[0]=TextBox1.Text;
r[1]=TextBox2.Text;
ds.Tables[0].Rows.Add(r);// dt.Rows.Add(r);
DataGrid1.DataSource =ds;
DataGrid1.DataBind();
venki
|
|
|
|
|
Hi,
I am using zip method provided by java.util.zip which takes input as sbyte[].I am getting response from a function in Stream.This stream is a file data.And when I am making conversion from byte[] to sbyte[] because of some Data loss I am not able to open the file which gives error like file is corrupted or damaged. I can think of some solutions but here are the problems with them-
1.> Can I convert this Stream to sbyte[],presently I am converting it to byte[] through MemoryStream.
2.> Presently I am directly putting this byte[] to Response.BinaryWrite() and its working but how to do that with sbyte[] conversion from byte[] to sbyte[] to create a zip entry and then again converting it to byte[] for Response.BinaryWrite can damage the file.
Any suggestion will be appreciated..
Prateek..
|
|
|
|
|
Hello,
I've read a lot about delegates and I understood the mechanics of creating them. What I don't get is, what situations you would use them in or what advantages do the bring.
Why would it be better to pass a delegate from classA to ClassB rather than just instantiating ClassA from ClassB and using ClassA's methods that way?
Thank you in advance.
Regards
Ranjit Vaity
Ranjit Vaity
|
|
|
|
|
robinnexus wrote: What I don't get is, what situations you would use them in
You use them every time you use events.
robinnexus wrote: what advantages do the bring
You can pass around references to a method on an object rather than the object itself. They can be multicast, allowing you to call more than one method with a single call.
robinnexus wrote: Why would it be better to pass a delegate from classA to ClassB rather than just instantiating ClassA from ClassB and using ClassA's methods that way
What if you already have an instance of ClassA and so instantiating a new instance in ClassB would give the wrong behaviour? Forms are a good example. Say FormA is already open and you want to call a method on FormB.... you cant just instantiate another FormA as this would be a different instance to the one currently open that you want to call a method on.
|
|
|
|
|
Hi J4amieC,
Thank you so much for you reply.
Cheers!
Ranjit
.NET crazy
|
|
|
|
|
http://www.ondotnet.com/pub/a/dotnet/2003/06/23/progCsharp3.html
|
|
|
|
|
Hi all,
what is he equivalent of a c struct in c#?
Thank you
|
|
|
|
|
Surprisingly, it is [url=http://msdn2.microsoft.com/en-us/library/saxz13w4(VS.80).aspx]Struct[/url]
|
|
|
|
|
hi all
i have some values on html page in javascript. i want to get that values in C#. how to do that.
I tried displaying it on a label, and retreave it from there.
This is the function in javascript
function display()<br />
{<br />
var localpath1 = document.getElementById('lblerr');<br />
lblerr.innerText = localpath;<br />
} it is diplaying the value on label. lblerr is the id of label. am calling this function on pageload
but when i try to get the value using lblerr.text, it is showing null.
y is it so?
how to get value on the label
|
|
|
|
|
innerText is a different property its not same as .Text.
Make a hidden variable in a form with runat="server" and assign it that value.
In .aspx
In javascript u can write
document.getElementById('hdnVar').value = localpath;
and in c#
lblerr.Text = hdVar.value.ToString();
Try it, It should work.
Prateek...
Prateek..
|
|
|
|
|
i had tried this one also previously.
error was occuring
the error is
System.NullReferenceException:Object reference not set to an instance of an object
what is this?
how to rectify this.
|
|
|
|
|
P_Elza wrote: m calling this function on pageload
but when i try to get the value using lblerr.text, it is showing null.
Try using this:
if (this.IsPostback)
{
string value = Request["lblerr"];
}
Hope it helps.
PS:
Don't open new topics....continue on the one already opened and try explain more detailed. Another hint: This is the C# forum...there is an ASP.NET forum also.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
Hi All,
How can a design a line control using C#. I want to make a line control like microsoft visio . means , after drwing the control i can change the postion , angle etc.
Any idea to start.
Thanks in advance
|
|
|
|
|
Abhijit Jana wrote: How can a design a line control using C#
Probably by doing alot of graphics coding. Sorry I wasn't very specific, but your question is out of the scope of a post.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
thanks for reply
|
|
|
|
|
Hi,
I need to enable active scripting option of internet explorer dynamically.
if anyone knows plz give the solution..
|
|
|
|
|
i made a profile page in my application and now i want that user can load his picture with all other information
please help me out how do i store / load picture in database along with all other information of the user
waiting for replies as soon as possible
regards 2 all
kanza
|
|
|
|
|
Why oh why don't you search Google or CodeProject? A simple search and I found this [^] article on CP. You can also try this [^]. Search the web...try...and if you have problems post here.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
if you want to upolad picture then do it and same the image path on database.
and in user profile while retriving the information , give the image path on the Picture box.
|
|
|
|
|
which control should i need to store picture ???
thanks 4 ur last reply bt being a beigner i dont fully understand
|
|
|
|