Rank: Newbie
Groups: Member
Joined: 1/9/2010(UTC) Posts: 7
|
Hi, I am trying to use the imageuploader toplace some images in a database on my server. So in the FileUploaded event i place my code to save the image to my db. This works fine - but now i want to have the user add some extra info in textboxes needed for my db save. But in the FileUploaded event the txtBoxes always appear empty? here is some snippets: from the asp page Quote:<asp:TextBox ID="txtCaseID" runat="server" CausesValidation="True"></asp:TextBox> <cc1:ImageUploader ID="ImageUploader1" runat="server" Height="449px" width="768px" RedirectUrl="MyUploads.aspx" UploadThumbnail1FitMode="Fit" UploadThumbnail1Width="120" UploadThumbnail1Height="120" OnFileUploaded="FileUploaded" /> c# codebehind Quote:protected void FileUploaded(object sender, Aurigma.ImageUploader.FileUploadEventArgs e) { if (txtCaseID.Text.Length > 0) {...dosql stuff..} } The txtCaseID is always empty when I enter the FileUpload event - whats the catch here??
|
|
|
|
Rank: Advanced Member
Groups: Administration
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hello, To resolve your problem you need to modify your code. To get the length of txtCaseID value you need to send it from client-side to server using Image Uploader method AddField in following way: Client-side: Code:<asp:TextBox ID="txtCaseID" runat="server" CausesValidation="True"></asp:TextBox>
<script type="text/javascript">
function Before_Upload()
{
getImageUploader("<%=ImageUploader1.ClientID%>").AddField("txtCaseID", document.getElementById("<%=txtCaseID.ClientID%>").value);
}
</script>
<cc1:ImageUploader ID="ImageUploader1" runat="server" Height="449px"
width="768px"
RedirectUrl="MyUploads.aspx"
UploadThumbnail1FitMode="Fit"
UploadThumbnail1Width="120"
UploadThumbnail1Height="120"
OnFileUploaded="FileUploaded"
OnClientBeforeUpload="Before_Upload" />
Server-side: Code:protected void FileUploaded(object sender, Aurigma.ImageUploader.FileUploadEventArgs e)
{
int tCaseID = Request.Form["txtCaseID"].Length;
if (tCaseID > 0)
{
//...dosql stuff..
}
}
I hope it helps you. |
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 1/9/2010(UTC) Posts: 7
|
Hi again, that really helped :d/
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.