|
Hai
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound" EnableViewState="false" ><br />
<HeaderTemplate><br />
<asp:LinkButton ID="lnkID" runat="server" EnableViewState="true" CommandName="Sort" CommandArgument="ID" OnCommand="LnkButton_Command" >LinkButton </asp:LinkButton><br />
<br />
<asp:LinkButton ID="lnkNmae" runat="server" EnableViewState="true" CausesValidation="true" CommandName="Sort" CommandArgument="Name" OnCommand="LnkButton_Command" >LinkButton</asp:LinkButton><br />
<br /><br />
</HeaderTemplate><br />
<ItemTemplate><br />
<%# Eval("ID") %> <%# Eval("ID") %><br />
</ItemTemplate><br />
<SeparatorTemplate><br />
<br /><br />
</SeparatorTemplate><br />
</asp:Repeater><br />
protected void LnkButton_Command(object sender, CommandEventArgs e)<br />
{<br />
<br />
Response.Write(e.CommandName);<br />
Response.Write("<BR>");<br />
Response.Write(e.CommandArgument);<br />
}
With this code i am creating a Sort facility in a repeator control for which i have added a in the header template and map the functionality to the header.
<asp:LinkButton ID="lnkNmae" runat="server" EnableViewState="true" CausesValidation="true" CommandName="Sort" CommandArgument="Name" OnCommand="LnkButton_Command" >LinkButton</asp:LinkButton>
Everything works cool up to this step.When i disabled the viewstate of Repeater 'LnkButton_Command' event is not fring. Is there any way todisable the parentcontrol view state and enable child view state.
|
|
|
|
|
One option is to replace the link buttons with links that place the sort order on the URL. This requires no viewstate. It also makes the page bookmarkable with a sort order.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks for your valuable suggestion.
The problem is if passing it as a querysting the whole data in the page needs to be reloaded. I only need to rebind the repetor. Is there any other way to do. i am really stucked here.
Thanks in advance
|
|
|
|
|
rebinding it surely means reloading the data ?
I don't thnk there's a way around it, you hae to turn viewstate back on.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks for your Help Graus.
Seems i must turn on ViewState for repetor. Is there any way i can turn off ItemTemplate and AlternateItemTemplate viewstate.
I am using Eval method to bind data
<td align="center" valign="middle" class="grid001"><br />
<%# Eval("CreatedDate", "{0:MM/dd/yyyy}")%><br />
</td>
Thanks in Advance
|
|
|
|
|
Hello Everyone,
I've stored the images in my database and now i want to display those images in my web page and i'm using the code given below for displaying it.....
But the compiler throwing an error
Invalid Parameter at Bitmap bitmap =new Bitmap(stream) line
plz try to understand my code and suggest me some way to come out of this.......
MemoryStream stream = new MemoryStream ();
SqlConnection connection = new SqlConnection (@"server=.;database=kiritbhai;uid=sa;pwd=");
try
{
connection.Open ();
SqlCommand command = new SqlCommand ("Select ImageFile from Rough_Images", connection);
byte[] image = (byte[]) command.ExecuteScalar ();
stream.Write (image, 0, image.Length);
Bitmap bitmap= new Bitmap (stream);
Response.ContentType = "image/gif";
bitmap.Save (Response.OutputStream, ImageFormat.Gif);
}
finally
{
connection.Close ();
stream.Close ();
}
|
|
|
|
|
The Knowledge wrote: But the compiler throwing an error
Invalid Parameter at Bitmap bitmap =new Bitmap(stream) line
That means that your data isn't really a bitmap.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
ok Here i'm sending my code for storing the images in the database
And also there are records in database which holds Images as <binary> and ImageType as image/gif
Plz sir have a look at my code suggest me the way................
Stream img_strm = uploadFile.PostedFile .InputStream ;
//Retrieving the length of the file to upload
int img_len=uploadFile.PostedFile .ContentLength ;
//retrieving the type of the file to upload
string strtype=uploadFile.PostedFile.ContentType.ToString ();
string strname=txtFileName.Text;
byte[] imgdata= new byte[img_len];
int n= img_strm.Read(imgdata,0,img_len);
//int result=SaveToDB(strname,imgdata,strtype);
DataUtility dUT=new DataUtility();
string strsql="Insert Into Rough_Images(ImageName,ImageFile,ImageType) Values('"+strname.ToString()+"','"+imgdata.ToString()+"','"+strtype.ToString()+"') ";
int result=dUT.ExecuteSql(strsql);
if(result>0)
{
Response.Write("Images Saved Successfully");
}
|
|
|
|
|
I'm not sure how calling tostring on a byte array will work, I'd expect it to null terminate when it finds a couple of 0s. This is one good reason not to use dynamic SQL like this, use a parameterised query or a stored proc.
You can check, by checking the length of the entry against the length of the array you started with.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
when i am tryibg to attach my database its showing the following error..
"An error occurred when attaching the database(s). Click the hyperlink in the Message column for details."
can any body guide me how to solve this !!!!!!!!!
|
|
|
|
|
bhattiprolu wrote: "An error occurred when attaching the database(s). Click the hyperlink in the Message column for details."
what is the details?
Paras Kaneriya The difference between genius and stupidity is that genius has its limits.
|
|
|
|
|
these are the details its providing...
TITLE: Microsoft SQL Server Management Studio Express
------------------------------
Attach database failed for Server 'Server Name'. (Microsoft.SqlServer.Express.Smo)
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
------------------------------
Unable to open the physical file "D:\mohan.bhattiprolu\Documents\Visual Studio 2005\WebSites\Prototype\App_Data\tempdb.mdf". Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476
|
|
|
|
|
You need to give the ASPNET user access to the file, in the file system.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
can you explain me in detail..
|
|
|
|
|
Right click on the file in the file system. Choose properties. Go to the security tab. If you don't have one, then your general file system probably has the simple security option set, you need to find that and remove it.
Now, click Add. Type ASPNET in the text box and click 'check names'. It should find it. Click OK. Now check 'full control'. Click OK.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i have maded some changes in my connection string and i run my program i am getting this error..
"CREATE DATABASE permission denied in database 'master'.
Cannot attach the file 'D:\mohan.bhattiprolu\Documents\Visual Studio 2005\WebSites\Prototype\App_Data\tempdb.mdf' as database 'tempdb.mdf'."
wat is this error how to fix this one?
|
|
|
|
|
bhattiprolu wrote: Click the hyperlink in the Message column for details
Hmmm... seems the IDE is trying to guide you.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I have a serious problem which is the following: i have a textbox control on the page with fixed width, and i want to resize the textbox to fit the text so that if the text is too long then the height of the textbox to increase. Any help is appreciated. Thanks in advance!
|
|
|
|
|
|
Hello!
I have a page with rezult of big query, I use GridView & ObjectDataSource to display them, but unfortunatly I found that ObjectDataSource fires Seletc twice I don't know why it happens. There is no databind on the page.
Page has masterpage. While debug it looks as PageLoad of page is finished and fires first Select, than the second Select fires after the MasterPage PageLoad finishes.
Thank you for help
|
|
|
|
|
Hi,
Friends, i need your help and suggestions..
In my project there are actually 2 kind of users...say ATP and Client..each one has it's own menus' and functions..they all accessing the same page..but the url will be different like
http://www.xxx.com/Client/Add.aspx ->for client and
http://www.xxx.com/ATP/Add.aspx ->for ATP...but they all will get the same page .."Add.aspx"
how will i manage this kind of url specifications...
Please help me ..it's very important for me....
Thanks & Regards
Alex.
|
|
|
|
|
Why does it have to work that way ? I wonder if you can set up two web apps in IIS that are called Client and ATP and point to the same base directory ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Malayil alex wrote: how will i manage this kind of url specifications...
You can use URLRewriting. You have to create a HTTPModule which listens the requests. If the incoming request is coming like http://www.xxx.com/Client/Add.aspx, redirect it to your real Add page with some querystring value to indicate it's a client request. Same way do for ATP also.
Context class comes with RewritePath() method. Make use of this.
|
|
|
|
|
Hi people,
I have a web service method that I would like to use to access a text file over the network, say the file is located at http://someserver.com/somefolder/myfile.txt . I have been searching with google and all I could find was how to read an XML file by providing a URL in this article: http://support.microsoft.com/kb/307643[^]
I was wondering if there was a way to do the same but with text files instead of XML files. It seems that TextReader or StreamReader do not access a URL as the path of the file.
Any insights are appreciated.
Thanks
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook
|
|
|
|
|
Talal Sultan wrote: I was wondering if there was a way to do the same but with text files instead of XML files.
Talal,
You can make use of WebClient class. This can be used to download data from remote URL. See the following snippet explains how you can read the text file from URL
System.Net.WebClient wc = new System.Net.WebClient();
byte[] b = wc.DownloadData("http://someserver.com/somefolder/myfile.txt");
string Text = System.Text.ASCIIEncoding.ASCII.GetString(b);
That's it, you will get text file content in Text variable. Now use some kind of regular expressions to parse it and read the necessary content.
Hope this helps
|
|
|
|